Page 1 of 1

OrdScope help

Posted: Sat May 04, 2013 4:00 pm
by fouednoomen
Dear All ,

How can I replace this function by OrdScope function

set filter to facture->cod_cli=client->cod_cli .and. facture->mont_fac-facture->avance >0


for information the index file is build as the following

use facture
Index on cod_cli+str(mont_fac-avance) tag xsolde to facture

I try this code but it dos not work

sele facture
SET ORDER TO 1
OrdScope(0,(client->cod_cli+'1'))
OrdScope(1,(client->cod_cli+'99999'))
dbgotop()




Regards

foued

Re: OrdScope help

Posted: Sat May 04, 2013 8:52 pm
by danielmaximiliano
Hi Foued :
I use this way ORDSCOPE .

Code: Select all

/*******************************************************/
Procedure Vencimientosordenar()
/*******************************************************/
cKey  := ""
cKey2 := ""
 ORDSCOPE( TOPSCOPE    , NIL )
 ORDSCOPE( BOTTOMSCOPE , NIL )
 cKey  := DTOS( Vencimientos.FECHA1.value)
 cKey2 := DTOS( Vencimientos.FECHA2.value)
 dbgotop()  // move the record pointer for the filter to take effect
 ordscope(TOPSCOPE   , "&cKey"  )  // set top scope
 ordscope(BOTTOMSCOPE, "&cKey2" )  // set bottom scope
 Vencimientos.grid_1.refresh
Return

Re: OrdScope help

Posted: Sat May 04, 2013 9:28 pm
by esgici
fouednoomen wrote:...

How can I replace this function by OrdScope function

set filter to facture->cod_cli=client->cod_cli .and. facture->mont_fac-facture->avance >0


for information the index file is build as the following

use facture
Index on cod_cli+str(mont_fac-avance) tag xsolde to facture

I try this code but it dos not work

sele facture
SET ORDER TO 1
OrdScope(0,(client->cod_cli+'1'))
OrdScope(1,(client->cod_cli+'99999'))
dbgotop()
...
Hi Foued

Using STR() without length (second) parameter, may cause some problems while building an index key and keys of an index should be same length.

So something like this may help you :

~~~~~~~~~~~~

nLengthOfMFacAv := 5

use facture
Index on cod_cli+str(mont_fac-avance,nLengthOfMFacAv) tag xsolde to facture

sele facture
SET ORDER TO 1
OrdScope(0,(client->cod_cli+PADL( '1', nLengthOfMFacAv ) )) // or SPACE(4) + "1"
OrdScope(1,(client->cod_cli+'99999'))
dbgotop()

~~~~~~~~~~~~~~

And, if we have some sample data for your tables helping you may be more easy.

Regards

Re: OrdScope help

Posted: Sat May 04, 2013 10:03 pm
by fouednoomen
Hi Esgici

Many thanks for your prompt replay

I look for this solution from 3 days


Regards

Foued

Re: OrdScope help

Posted: Sun May 05, 2013 1:24 pm
by dhaine_adp
Hi Foued,

You can also used these commands:

Code: Select all

USE EMPLOYEE ALIAS EMPLOYEE NEW VIA RDDSETDEFAULT()
INDEX ON ID Tag ID TO Employee
INDEX ON DOB Tag DOB TO Employee

// At later part or another module of your code you can for example:
USE EMPLOYEE ALIAS EMPLYEE NEW
ORDLISTADD( "Employee" ) 
ORDSETFOCUS( "ID", "Employee")
To adopt your code you should do:

Code: Select all

use facture
Index on cod_cli+str(mont_fac-avance) tag xsolde to facture

** declare these variables below at the top of your function
PRIVATE cTopBound 
PRIVATE cLowBound

sele facture
SET ORDER TO 1
cTopBound := client->cod_cli + "1"
cLowBound := client->cod_cli + '99999'
OrdScope(0, "&cTopBound" )
OrdScope(1, "&cLowBound" )
dbgotop()
Regards,

Danny