{{tag>category:"OpenInsight 32-bit" author:"cmeyer" author:"Andrew McAuley" author:"Barry Stevens" author:"Brad Bishop" author:"Carl Pates"}} [[https://www.revelation.com/the-works|Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community]] ==== 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 end That said x = 161919900030083661 y = num( x ) returns true for me in 32 and 64 bit OI. [url=https://www.sprezzatura.com]The Sprezzatura Group[/url] [url=https://www.sprezzatura.com/blog]The Sprezzatura Blog[/url] [i]World leaders in all things RevSoft[/i] [img]https://www.sprezzatura.com/zz.gif[/img] ---- === 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 end That said x = 161919900030083661 y = num( x ) returns true for me in 32 and 64 bit OI. [url=https://www.sprezzatura.com]The Sprezzatura Group[/url] [url=https://www.sprezzatura.com/blog]The Sprezzatura Blog[/url] [i]World leaders in all things RevSoft[/i] [img]https://www.sprezzatura.com/zz.gif[/img] 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. [url=https://www.sprezzatura.com]The Sprezzatura Group[/url] [url=https://www.sprezzatura.com/blog]The Sprezzatura Blog[/url] [i]World leaders in all things RevSoft[/i] [img]https://www.sprezzatura.com/zz.gif[/img] ---- === 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. [url=https://www.sprezzatura.com]The Sprezzatura Group[/url] [url=https://www.sprezzatura.com/blog]The Sprezzatura Blog[/url] [i]World leaders in all things RevSoft[/i] [img]https://www.sprezzatura.com/zz.gif[/img] 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 notNbr If nbr # '' Then * Not a number End Else * Is a number End ---- === At 03 AUG 2022 04:50PM Barry Stevens wrote: === nbr = '0123456789098765432109876543210123456789' notNbr= 'A01234567890c98765432109v876543210.123456789' Convert '0123456789' To '' In nbr Convert '0123456789' To '' In notNbr If nbr # '' Then * Not a number End Else * Is a number End the issue is: why does this work: nbr = '0123456789098765' IsNum1 = num(nbr) and this not: nbr = '01234567890987654' IsNum2 = num(nbr) ---- === 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. [url=https://www.sprezzatura.com]The Sprezzatura Group[/url] [url=https://www.sprezzatura.com/blog]The Sprezzatura Blog[/url] [i]World leaders in all things RevSoft[/i] [img]https://www.sprezzatura.com/zz.gif[/img] >>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. [url=https://www.sprezzatura.com]The Sprezzatura Group[/url] [url=https://www.sprezzatura.com/blog]The Sprezzatura Blog[/url] [i]World leaders in all things RevSoft[/i] [img]https://www.sprezzatura.com/zz.gif[/img] >>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. [url=https://www.sprezzatura.com]The Sprezzatura Group[/url] [url=https://www.sprezzatura.com/blog]The Sprezzatura Blog[/url] [i]World leaders in all things RevSoft[/i] [img]https://www.sprezzatura.com/zz.gif[/img] >>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. [email=cpates@revsoft.co.uk]Carl Pates[/email] ---- === 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. [email=cpates@revsoft.co.uk]Carl Pates[/email] 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. [[https://www.revelation.com/revweb/oecgi4p.php/O4W_HANDOFF?DESTN=O4W_RUN_FORM&INQID=WORKS_READ&SUMMARY=1&KEY=FC91A8B1A06DE6459D10E2A2EBBAFF2D|View this thread on the Works forum...]]