isnumber Function
Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
3 posts
Page 1 of 1
Is there a comparable function to isnumber in GAD? I'm trying to base an if statement on whether the variable returned is a number (0-9), I've tried this:
${decimal(fnameChar)==1 OR decimal(fnameChar)==2 OR decimal(fnameChar)==3 OR decimal(fnameChar)==4 OR decimal(fnameChar)==5 OR decimal(fnameChar)==6 OR decimal(fnameChar)==7 OR decimal(fnameChar)==8 OR decimal(fnameChar)==9}
but it fails with this error: [8099 - print] An unexpected error occurred. Function 'Decimal': Parameter '1' must be a number. Function definition: 'Decimal(number) returns decimal'
I assume it's because the variable fnameChar is a 't'. I was hoping it would say 'well, "t" is not a 1 or 2 or ect. . .' and carry on.
Any advice on this? thank!
${decimal(fnameChar)==1 OR decimal(fnameChar)==2 OR decimal(fnameChar)==3 OR decimal(fnameChar)==4 OR decimal(fnameChar)==5 OR decimal(fnameChar)==6 OR decimal(fnameChar)==7 OR decimal(fnameChar)==8 OR decimal(fnameChar)==9}
but it fails with this error: [8099 - print] An unexpected error occurred. Function 'Decimal': Parameter '1' must be a number. Function definition: 'Decimal(number) returns decimal'
I assume it's because the variable fnameChar is a 't'. I was hoping it would say 'well, "t" is not a 1 or 2 or ect. . .' and carry on.
Any advice on this? thank!
- Support Specialist
- Posts: 590
- Joined: Tue Jul 17, 2012 2:12 pm
- Location: Phoenix, AZ
-
WallyD...
There isn't an "IsNumeric" function currently built into GAD. There are 2 options though.
1. Take advantage of an SQL Function like MSSQL IsNumeric() and return the value (condition) you're looking for then continue as needed.
2. Use the Utility below that I created some time ago ... it will help you identify whether or not the value passed into the Utility is Numeric or not.
**NOTE** .. this can be tweaked to include decimals, etc. Currently set for whole numbers only.
There isn't an "IsNumeric" function currently built into GAD. There are 2 options though.
1. Take advantage of an SQL Function like MSSQL IsNumeric() and return the value (condition) you're looking for then continue as needed.
2. Use the Utility below that I created some time ago ... it will help you identify whether or not the value passed into the Utility is Numeric or not.
**NOTE** .. this can be tweaked to include decimals, etc. Currently set for whole numbers only.
Code: Select all
<project name="IsNumeric" mainModule="Main" version="2.0" logLevel="silent">
<module name="Main">
<raiseError label="Have MyVal?" version="1.0" executeOnlyIf="${ IsEmpty( MyVal ) }">
<message>MyVal cannot be blank! Try again ...</message>
</raiseError>
<setVariable label="Setvar: IsNumeric" name="IsNumeric" value="${ If( IsEmpty( Replace( MyVal , '[0-9]', '')), true, false ) }" version="2.0" />
<print label="Status" version="1.0">
<![CDATA[
====================================
MyVal: ${MyVal} -- is Numeric? ${IsNumeric}
====================================]]>
</print>
</module>
<variable name="MyVal" value="" />
</project>
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
3 posts
Page 1 of 1