We are converting data files and we want to test invalid numeric data errors in our converted files. What is the best way to do so? Is there any scalar function that returns NULL if the content of a numeric field is invalid?
OK, apparently you're talking about character data that needs to be limited to numbers. If that's correct, this will check the data for you. Let's assume you're dealing with a field called cNumber.
Code:
IF LEN(CHRTRAN(cNumber,'1234567890',"") > 0
= MESSAGEBOX("Bad data ...")
ENDIF
Actually, I left off the final closing ) and the code probably wouldn't work against the field itself. You'd need to store the data to a variable and check the variable.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.