Page 1 of 1

Checking if a numeric variable is completly filled

Posted: May 8th, 2019, 12:36 pm
by Eohmer
Hello!

I was wondering if there's any function or something that can help me check if a numeric variable is completly filled.

For example:
"numericVariable" is a numeric variable of length 8. That variable must always have all its length filled. Does CSPRO have any function that checks that or anyone knows how it can be done?

Thank you!

Re: Checking if a numeric variable is completly filled

Posted: May 8th, 2019, 2:47 pm
by htuser
Hi,
This issue has been solved. Please see:
http://csprousers.org/forum/viewtopic.p ... eric#p5829
To have the length of entered value, please use mathematic function such as the Log Function .
Then compare the maxvalue and the result of the mathematical operation.
For more, please see https://stackoverflow.com/questions/306 ... teger-in-c

Best Regards,

Re: Checking if a numeric variable is completly filled

Posted: May 8th, 2019, 2:54 pm
by josh
That depends on how you define "completely filled". Is it allowed to have leading zeros? If not then you can simply check if it is greater than or equal 10000000 since any 8 digit number must be at least that big. If it can have leading zeros then you really aren't talking about number in the mathematical sense. There you want a string of 8 digits like a phone number or an account number. In that case, make the item type alphanumeric and use a regular expression to check that it is 8 characters long and only numeric. Something along the lines of:
if not regexmatch(MYFIELD, "^[0-9]{8}$") = 0 then
Check out this blog post for more info on regular expressions: http://www.csprousers.org/posts/2019-02 ... sions.html