Page 1 of 1

IsNumber function?

Posted: Tue Jun 07, 2005 12:31 pm
by jmiskey
I see that there is an ISALPHA function available, but is there something like an ISNUMBER or ISNUMERIC function also?____I need to verify that a certain entry contains only numeric values.____Thanks.

=> RE: IsNumber function?

Posted: Thu Jun 09, 2005 12:31 pm
by kfleming
The VAL() function will take you part of the way. It turns a string into a number so that "10AAA" would become the numeric 10. You would need to do some additional calculation to throw out a "10AAA" as a bad guy and keep "10.111" as a good guy. You could probably check the length of the string and the length of the VAL() converted back to a string to see if they are different so that the two characters for the 10 being less that the 5 characters in the original string would indicate an error. But start with VAL().____Kathleen__R&R Support

==> RE: IsNumber function?

Posted: Thu Jun 09, 2005 2:04 pm
by jmiskey
I don^t think that will work.____Essentially, we have a test string that requires that the entries in spaces 6-11 all be numeric. I am trying to write code to verify that only numbers reside in these spaces. So, I am checking for any non-numeric values (i.e. letters, spaces, symbols, etc.)

===> RE: IsNumber function?

Posted: Thu Jun 09, 2005 11:34 pm
by kfleming
Then you can use the VAL() function on even the INLIST function along with the SUBS() function if you want to test particular characters within the field.____For example:__IIF(INLIST(SUBS(myfield,6,1),^0^,^1^,^2^,^3^,^4^,^5^,^6^,^7^,^8^,^9^)=0,"The 6th character IS NOT a number","6th is indeed numeric")____Kathleen__R&R Support

====> RE: IsNumber function?

Posted: Fri Jun 10, 2005 7:51 am
by jmiskey
I have ten characters I need to check (spaces 6-10 and spaces 12-16). So in order to use this method, I would need to write 10 equations, one to check each space?____I was hoping for an easier/more efficient way, like just checking the 2 sequences in whole (6-10 and then 12-16) to see if the values as a whole are valid numbers.

=====> RE: IsNumber function?

Posted: Fri Jun 10, 2005 8:08 am
by kfleming
You could probably create a recursive function to do this. Have a look at the article http://www.livewarepub.com/ftp/TechDocs/Recursive_Functions.pdf for some examples of recursive functions.______Kathleen__R&R Support