[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
RE: [sqr-users] How to check 'CHAR' field to find out ifitcontainsall Numeric?
- Subject: RE: [sqr-users] How to check 'CHAR' field to find out ifitcontainsall Numeric?
- From: "Jamie Harris" <JHarris@frederick.edu>
- Date: Thu, 14 Oct 2004 17:10:58 -0400
- Delivery-date: Thu, 14 Oct 2004 16:15:04 -0500
- List-id: "This list is for discussion about the SQR database reportinglanguage from Hyperion Solutions." <sqr-users.sqrug.org>
Actually, I think Kevin is right. Kevin's way returns the correct output, but
your way seems to always say the string contains letters.
The code below shows this as the output:
-------------
Kevin's way
-------------
123124 All numeric
ABCDEF Contains non-numeric characters
-------------
Tchaha's way
-------------
123124 Contains non-numeric characters
ABCDEF Contains non-numeric characters
Here is the code:
show '-------------'
show 'Kevin''s way'
show '-------------'
let $string = '123124'
show $string noline
if $string <> '' and translate($string, '0123456789', '') = ''
show ' All numeric'
else
show ' Contains non-numeric characters'
end-if
let $string = 'ABCDEF'
show $string noline
if $string <> '' and translate($string, '0123456789', '') = ''
show ' All numeric'
else
show ' Contains non-numeric characters'
end-if
show '-------------'
show 'Tchaha''s way'
show '-------------'
let $string = '123124'
show $string noline
if $string <> '' and translate($string, '','0123456789') = ''
show ' All numeric'
else
show ' Contains non-numeric characters'
end-if
let $string = 'ABCDEF'
show $string noline
if $string <> '' and translate($string, '','0123456789') = ''
show ' All numeric'
else
show ' Contains non-numeric characters'
end-if
-----------------------------------------------------
James Harris
Junior Systems Programmer/Analyst
Information Technology Division
Frederick Community College
-----------------------------------------------------
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users