How to check if text field is numeric
I have data in a field that I only want to use if the data is numeric.
Is there anything simple that works like the Isnumeric() function in Excel?
I tried writing something using REGEXP but it does not make it through the syntax check. (It should work since I got it off of a MySql forum). Here's an example. The field that contains my data is called "VWAP".
"VWAP" REGEXP '^(-|\\+)?([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+|[0-9]+)$'
I have also tried using the CAST function to convert to a decimal. This converts text to 0, which is only partly useful since I can't distinguish that from a 0 that was original 'valid' data. But at least it converts.
However, when I try to embed the CAST function in a comparison in an IF statement, the comparison does not work properly, as in:
IF( CAST( "VWAP" AS DECIMAL(16,5)) > 0 , 'Usable', 'Not Usable') AS "Usability",
Any help would be appreciated.
Thanks.