IS_NUMBER / IS_STRING

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

IS_NUMBER / IS_STRING

Post by PointsWell »

I need to evaluate whether the value of a function against a text attribute is a number.

So for example when I use

Code: Select all

AS_NUMBER(BO.Attribute)
Where BO.Attribute is a text attribute but may contain numeric how can I check whether AS_NUMBER is returning a number, for example when the field contains '5', but if I run this when the field contains 'five' then what is the response?

Is there a way to check that AS_NUMBER is working against an actual numeric because from the user guide:
Converts the given string into a number. If a string cannot be converted the original string is returned.
BobK
Posts: 544
Joined: Thu Jan 31, 2008 2:14 pm
Location: Cincinnati, Ohio, USA

Re: IS_NUMBER / IS_STRING

Post by BobK »

You can use MATCHES with a Reg Ex to test for all numbers.

Code: Select all

If MATCHES(BO.Attribute, '[0-9]*') = 'Yes' Then
BO.Nbr = AS_NUMBER(BO.Attribute)
Bob
Post Reply