Page 1 of 1

xBrowse AUTOSORT DBF does not work

Posted: Wed Dec 25, 2019 6:17 pm
by MOISES
Hello,

I have an xBrowse defined such way:

Code: Select all

  @ 14,72 XBROWSE oVMenuBrowse SIZE -10,-21 PIXEL OF oDlg ;
          ALIAS "CLIENTES" AUTOSORT;
          FIELDS CLIENTES->CODIGO,CLIENTES->NOMBRE ;
          HEADERS "Código", "Nombre"  ;
          SIZES  90, 80
 
Indexes are:

Code: Select all

   INDEX ON NOMBRE TAG CLIENTES1  FOR !Deleted()
   INDEX ON CODIGO TAG CLIENTES2  FOR !Deleted()
Thank you.

Re: xBrowse AUTOSORT DBF does not work

Posted: Thu Dec 26, 2019 4:05 am
by nageswaragunupudi

Code: Select all

@ 14,72 XBROWSE oVMenuBrowse SIZE -10,-21 PIXEL OF oDlg ;
          ALIAS "CLIENTES" AUTOSORT;
          COLUMNS "CODIGO","NOMBRE" ;
          HEADERS "Código", "Nombre"  ;
          SIZES  90, 80
 
Autosort works when you use COLUMNS clause like this. Does not work when you use FIELDS clause.

We advise you to use COLUMNS clause only and never to use FIELDS clause.

Note: FIELDS clause was created for compatibility with WBrowse syntax to ease initial migration.

Re: xBrowse AUTOSORT DBF does not work

Posted: Thu Dec 26, 2019 9:23 am
by MOISES
Thank you.

But in some xbrowse cols, I have defined the field like this:

( CONCEPTO->IMPORTE + (CONCEPTO->IMPORTE*CONCEPTO->IVA/100) - (CONCEPTO->IMPORTE*CONCEPTO->IRPF/100) )

But in COLUMNS clause does not work. How should I proceed please?

Re: xBrowse AUTOSORT DBF does not work

Posted: Thu Dec 26, 2019 10:01 am
by nageswaragunupudi
In the COLUMNS clause, we can include expressions also, as long as the expression can be evaluated in another module, i.e., expressions not containing local variables or static functions.

The above can be written as

Code: Select all

COLUMNS "IMPORTE+(IMPORTE*IVA/100)-(IMPORTE*IRPF/100)", "NEXTCOL", ...
Incidentally, the expression IMPORTE+(IMPORTE*IVA/100)-(IMPORTE*IRPF/100) can be simplified as IMPORTE * ( 1 + ( IVA-IRPF) / 100 )

So we can write

Code: Select all

COLUMNS "IMPORTE * ( 1 + ( IVA-IRPF) / 100 )", "NEXTCOL", ...