MESSAGEBOX(VAL(SUBSTR([abc152] , getNumberPosition([abc152])))) MESSAGEBOX(VAL(SUBSTR([a152] , getNumberPosition([a152])))) MESSAGEBOX(VAL(SUBSTR([152] , getNumberPosition([152])))) MESSAGEBOX(VAL(SUBSTR([abcdefg152] , getNumberPosition([abcdefg152])))) MESSAGEBOX(VAL(SUBSTR([ab] , getNumberPosition([ab])))) RETURN *- This function return a initial position of number. *- If have no number, return one position bigger that len of tsText (999) FUNCTION getNumberPosition(tsText as String) as Number LOCAL lnPosition as Number LOCAL lnFor as Number lnPosition = 999 FOR lnFor = 1 TO LEN(tsText) lnPosition = MIN(lnPosition, IIF(ISDIGIT(SUBSTR(tsText, lnFor, 1)), lnFor, 999)) ENDFOR RETURN lnPosition ENDFUNCGood luck!
>>lnSticket = Val(SubStr(Sticket, 4)) >>lnEticket = Val(SubStr(Eticket, 4))>>In other case you can to do a parse and look for a first number and substract it.
>>>Sticket=ABC100 CHAR TYPE >>>Eticket=abc40 CHAR TYPE >>>NOOFTICKET NUMARIC TYPE >>>NOOFTICKET= Sticket- Eticket=60>>>THANKS