lcLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" lcCharList = lcLetters lnBase = LEN(lcCharList) lcVal = "" FOR i=1 TO 4 lnRest = (lnVal % lnBase) lnVal = INT( lnVal / lnBase) lcVal = SUBSTR( lcCharList, lnRest + 1 , 1 ) + lcVal ENDFOR>Nice shot. However, exactly your case ("whatever") showed a problem. It could be repaired by decreasing lnBase with 1 and increasing lnRest with 1. Here's the testcode:
create cursor c_sys2007 ( theNumber i, theString c(10) ) >for n = 1 to 99999 > lnval = n > lcLetters = "ABCDEFGHIJKLMNOPQRSTUVWXY" > lcCharList = lcLetters + LOWER(lcLetters) > lnBase = LEN(lcCharList) - 1 > lcVal = "" > DO WHILE lnVal > 0 > lnRest = lnVal % lnBase > lnVal = INT( lnVal / lnBase) > lcVal = SUBSTR( lcCharList, lnRest + 1, 1 ) + lcVal > ENDDO > insert into c_sys2007 values ( n, lcVal ) >next > >browse title "Raw result" > >select cnt(*) as _cnt, theString from c_sys2007 order by 2 group by 2 into cursor c_sys2007a >browse title "Occurence of each string - Desc - Column 1 should have no other value than 1" > >select len(alltrim(thestring)) as theLen from c_sys2007a order by 1 desc into cursor c_sys2007b >select dist theLen from c_sys2007b order by 1 desc into cursor c_sys2007c >browse title "Distinct of lengths">