Information générale
Catégorie:
Codage, syntaxe et commandes
>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
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement