Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Multiple Index tag - help
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00209679
Message ID:
00209688
Views:
28
>How about index on fullname + dtos({^2999/03/18}-newDate)

OOPS, that's what stream of consciousness typing does for you. This will really work, I tested it.

This is a little uglier than i would like. It stems from the VFP bug that you can't do this
index on fullname + str({^2999/03/18}-newDate) to myidx. For some bizarre reason this gives you an invalid key length.

If you put x={^2999/03/18} and then
index on fullname + str(x-newDate) to myidx, this works but i don't like to have variables in my index expressions unless absolutely necessary.

I created a little function called DES (short for descending which was already taken)

here it is:

function des
parameters uVar

do case
case vartype(uVar)="N"
return(9999999999-uVar)
case vartype(uVar)="D"
return({^2999/01/01}-uVar)
case vartype(uVar)="C"
local nCnt, cRetVal
cRetVal=""
for nCnt=1 to len(uVar)
cRetVal=cRetVal+chr(ASC("[")-ASC(substr(uVar,nCnt,1))+64)
endfor nCnt
return(cRetVal)
otherwise
=messagebox("unimplemented case")
endcase


using this you can build your index by typing:

index on lastname+str(des(date)) to c:\temp\x


hth

scott
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform