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"I think I'll gonna use a variation. lcCharlist will be lcLetters only, in order to have only upper case in the outcome. And I want the string to be four positions always. That can be accomplished by reserving the Z, so by decreasing lcLetters with 1 and doing padr() with the Z.
>CLEAR >lnVal = INT(VAL(SYS(2007, "whatever"))) > >lcLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" >lcCharList = lcLetters + LOWER(lcLetters) >lnBase = LEN(lcCharList) >lcVal = "" >DO WHILE lnVal > 0 > lnRest = lnVal % lnBase > lnVal = INT( lnVal / lnBase) > lcVal = SUBSTR(lcCharList, lnRest,1) + lcVal >ENDDO >? lcVal >>>