validate large numeric 161919900030083661 (OpenInsight 32-bit)
At 02 AUG 2022 10:32:49PM cmeyer wrote:
The Num(161919900030083661) function returns invalid although this BPay refence number is numeric.
What can I do to validate a large numeric number.
Any advice would be grateful.
Chris
At 03 AUG 2022 04:04AM Andrew McAuley wrote:
if len( string ) then convert "0123456789" to "" in string if len(String) then num = false$ else num = true$ end else * your call endThat said
x = 161919900030083661
y = num( x )
returns true for me in 32 and 64 bit OI.
World leaders in all things RevSoft
At 03 AUG 2022 04:18AM Barry Stevens wrote:
if len( string ) then convert "0123456789" to "" in string if len(String) then num = false$ else num = true$ end else * your call endThat said
x = 161919900030083661
y = num( x )
returns true for me in 32 and 64 bit OI.
World leaders in all things RevSoft
x = "161919900030083661"
y = num( x )
returns false
At 03 AUG 2022 04:30AM Andrew McAuley wrote:
well, by quoting it you ARE telling OI it is a string not a number - if you check the debugger X remains as 161919900030083661 with the quotes. Without the quotes it shows an exponential figure. OI cannot store an integer > 2^31 in 32 bit OI. Predictably this works in 64 Bit OI even with the quotes as OI can then store an integer up to 2^63.
World leaders in all things RevSoft
At 03 AUG 2022 05:14AM Barry Stevens wrote:
well, by quoting it you ARE telling OI it is a string not a number - if you check the debugger X remains as 161919900030083661 with the quotes. Without the quotes it shows an exponential figure. OI cannot store an integer > 2^31 in 32 bit OI. Predictably this works in 64 Bit OI even with the quotes as OI can then store an integer up to 2^63.
World leaders in all things RevSoft
If the value is 10 digits it works , 20 digits it does not.
BTW: The issue showed up with a 18 digit value entered in a form field by a user, then prior to save it is checked for numeric which failed. Is there an issue with how the data is retrived from the form field (not sure if TEXT or DEFAULT or what the field 'type' is) I assume that all planets have to align, so, how should the field be 'typed' and 'GET'ed.
At 03 AUG 2022 08:22AM Brad Bishop wrote:
nbr = '0123456789098765432109876543210123456789'
notNbr= 'A01234567890c98765432109v876543210.123456789'
Convert '0123456789' To
In nbr Convert '0123456789' To
In notNbrIf nbr #
Then * Not a number End Else * Is a number End </QUOTE> —- === At 03 AUG 2022 04:50PM Barry Stevens wrote: === <QUOTE> <QUOTE> nbr = '0123456789098765432109876543210123456789' notNbr= 'A01234567890c98765432109v876543210.123456789' Convert '0123456789' To
In nbrConvert '0123456789' To
In notNbr If nbr #
Then
Not a numberEnd Else
Is a numberEnd
the issue is:
why does this work:
nbr = '0123456789098765'
IsNum1 = num(nbr)
and this not:
nbr = '01234567890987654'
IsNum2 = num(nbr)
</QUOTE>
At 03 AUG 2022 05:04PM Barry Stevens wrote:
well, by quoting it you ARE telling OI it is a string not a number - if you check the debugger X remains as 161919900030083661 with the quotes. Without the quotes it shows an exponential figure. OI cannot store an integer > 2^31 in 32 bit OI. Predictably this works in 64 Bit OI even with the quotes as OI can then store an integer up to 2^63.
World leaders in all things RevSoft
Without the quotes it shows an exponential figure. OI cannot store an integer > 2^31 in 32 bit OI.Sorry, missed that bit.
That explains it then, thanks.
At 03 AUG 2022 06:13PM Barry Stevens wrote:
well, by quoting it you ARE telling OI it is a string not a number - if you check the debugger X remains as 161919900030083661 with the quotes. Without the quotes it shows an exponential figure. OI cannot store an integer > 2^31 in 32 bit OI. Predictably this works in 64 Bit OI even with the quotes as OI can then store an integer up to 2^63.
World leaders in all things RevSoft
Without the quotes it shows an exponential figure. OI cannot store an integer > 2^31 in 32 bit OI.Sorry, missed that bit.
That explains it then, thanks.
Mmmm, funny how this works then
![]()
value='161919900030083661'
validate(value,'0N')
ValStatus =Status()
At 03 AUG 2022 06:17PM Barry Stevens wrote:
well, by quoting it you ARE telling OI it is a string not a number - if you check the debugger X remains as 161919900030083661 with the quotes. Without the quotes it shows an exponential figure. OI cannot store an integer > 2^31 in 32 bit OI. Predictably this works in 64 Bit OI even with the quotes as OI can then store an integer up to 2^63.
World leaders in all things RevSoft
Without the quotes it shows an exponential figure. OI cannot store an integer > 2^31 in 32 bit OI.Sorry, missed that bit.
That explains it then, thanks.
Mmmm, funny how this works then
![]()
value='161919900030083661'
validate(value,'0N')
ValStatus =Status()
…I assume it must be using Andrew's trick!
At 03 AUG 2022 09:47PM Carl Pates wrote:
Apples and Oranges.
validate on "0N" is a simple pattern match - it does not attempt to perform a numeric conversion on the data at all - it just scans the string checking that every character is a digit.
Num attempts a string→number conversion to something it can hold internally - if it can't then it's not a number that can be used with any of the math functions.
At 03 AUG 2022 09:52PM Barry Stevens wrote:
Apples and Oranges.
validate on "0N" is a simple pattern match - it does not attempt to perform a numeric conversion on the data at all - it just scans the string checking that every character is a digit.
Num attempts a string→number conversion to something it can hold internally - if it can't then it's not a number that can be used with any of the math functions.
The number was just an account number got used to using num() to check it is all numbers without thinking of ramifications down the line as was not aware of the deeper internals.
Have to remember to only use num() for checking if going to do a calculation.
Thank you.