OrdScope help

Moderator: Rathinagiri

Post Reply
User avatar
fouednoomen
Posts: 89
Joined: Sun Oct 14, 2012 8:33 am
DBs Used: DBF,MySql
Location: Tunisia
Been thanked: 1 time

OrdScope help

Post by fouednoomen » Sat May 04, 2013 4:00 pm

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

User avatar
danielmaximiliano
Posts: 2051
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 89 times
Been thanked: 12 times
Contact:

Post by danielmaximiliano » Sat May 04, 2013 8:52 pm

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
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`.HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. : +54901169026142
Telegram Name : DaNiElMaXiMiLiAnO

User avatar
esgici
Posts: 4363
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 245 times
Been thanked: 91 times
Contact:

Post by esgici » Sat May 04, 2013 9:28 pm

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
Viva INTERNATIONAL HMG :D

User avatar
fouednoomen
Posts: 89
Joined: Sun Oct 14, 2012 8:33 am
DBs Used: DBF,MySql
Location: Tunisia
Been thanked: 1 time

Post by fouednoomen » Sat May 04, 2013 10:03 pm

Hi Esgici

Many thanks for your prompt replay

I look for this solution from 3 days


Regards

Foued

User avatar
dhaine_adp
Posts: 457
Joined: Wed Aug 06, 2008 12:22 pm
Location: Manila, Philippines
Been thanked: 1 time

Post by dhaine_adp » Sun May 05, 2013 1:24 pm

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
Regards,

Danny
Manila, Philippines

Post Reply