08-21-2004, 08:52 AM
There is one weak place:
c.trim("AMOUNT (")
Here "AMOUNT (" is set of characters that are trimmed. Now this succeeds, and it would also succeed if c would be eg "TNU 100,000.00A". But if c sometimes has different format, this statement may fail to extract the number. Then c would not be numeric, and a=c would throw "...Type mismatch" error.
Regular expressions are ideal to extract numbers and other complex substrings. Try this:
To show last error line, press F2. To show automatically, set it in Options.
c.trim("AMOUNT (")
Here "AMOUNT (" is set of characters that are trimmed. Now this succeeds, and it would also succeed if c would be eg "TNU 100,000.00A". But if c sometimes has different format, this statement may fail to extract the number. Then c would not be numeric, and a=c would throw "...Type mismatch" error.
Regular expressions are ideal to extract numbers and other complex substrings. Try this:
CURRENCY a b="100000"
str c="AMOUNT (100,000.00)"
if(findrx(c "\d+(,\d+)*\.\d\d" 0 2 c)<0) out "number not found"; ret
a=c
mes iif(a<=b "ok" "not ok")
To show last error line, press F2. To show automatically, set it in Options.