************************************************************************ FUNCTION SKUToInt * Convert integer to SKU * SKUtoInt(SKU) in the form of "123ABC" ************************************************************************ PARAMETERS lcEncSKU PRIVATE aEncTab, lcEncSKU lcEncSKU = LTRIM(lcEncSKU,1,"0") aEncTab = [0123456789ABCDEFGHJKLQRSTUVWXYZ] && Exclude letters OIMNP, pad with zeros lnInt = 0 lnFactor = 1 *!* IF LEN(lcEncSKU) > 1 *!* SET STEP ON *!* ENDIF FOR i = LEN(lcEncSKU) TO 1 STEP -1 lcChar = SUBSTR(lcEncSKU,i,1) lnInt = lnInt + ((AT(lcChar,aEncTab)-1) * lnFactor) lnFactor = lnFactor*LEN(aEncTab) NEXT RETURN lnInt ENDFUNC && SKUToInt
Now I just need the integer to SKU (alphanumeric code) part...