>Greetings!
>
>I need to set up an index to sort records using a mix of ascending and descending orders, using character fields.
>
>I recall this could be done using the SYS(15) function ("included for backward compatibility"). I've done it before, but now do not remember how! Apparently, the list of fields in the sort order would include something like "SYS(15, "ZYXW...", field)". This would cause the field to be sorted in descending order by substituting each character--a "Z" for an "A", "Y" for "B", and so forth.
>
>However, it does not work. Does anyone else know how to do this?
>
>Thanks!
>
>Michael Reynolds
The second parameter in sys(15) must be 256 characters long, i.e. full table. Its first character is a replacement for chr(0), its nth a replacement for chr(n-1). Maybe there are workarounds for this, but I'm not sure.
cTable=""
for i=0 to 255
ctable=ctable+chr(255-i)
endfor
index on sys(15, ctable, yourcharfield) ...