Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
+1
person also asked this
people also asked this
Replies
3 replies
Subscribers
8 subscribers
Views
12914 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
We have text fields that we need to validate are numbers. For example, if the v
Mike James
Certified Lead Developer
over 10 years ago
We have text fields that we need to validate are numbers. For example, if the value is "134" or "1456.45" it should pass. but the rule should fail on "TEXT" or "3A5T.57".
Initially, we tried a validation expression like: if(todecimal(ri!textinput)=ri!textinput, true, false) ...however this ran out of usefulness when the text input is greater that 8 characters because Appian starts to round decimals or use scientific notation. So we were failing valid numbers such as "100000.35"
Does anyone have a good way we could perform this validation?
OriginalPostID-142914
OriginalPostID-142914
Discussion posts and replies are publicly visible
Top Replies
abhi.jana
over 10 years ago
+1
Appian Employee
Try - =if(regexmatch("^([0-9.]{1,50})$",ri!input),"Number","Text") Assuming the input is limited to 50 characters. You can further customize the regex pattern to match more specific inputs. The regexmatch…
0
Josh
Certified Lead Developer
over 10 years ago
My first thought is that you could use code() and then validate each unicode character. A bit of a hassle though.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Conor Cahill
Certified Lead Developer
over 10 years ago
You can check the length of the string before and after running the text through a cleanwith(), using "0123456789." as your clean text. You can also check that there's a max of 1 decimal point if you want to validate that as well.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
abhi.jana
Appian Employee
over 10 years ago
Try -
=if(regexmatch("^([0-9.]{1,50})$",ri!input),"Number","Text")
Assuming the input is limited to 50 characters. You can further customize the regex pattern to match more specific inputs.
The regexmatch() function is part of the Appian Regular Expression Functions shared component -
forum.appian.com/.../summary
Cancel
Vote Up
+1
Vote Down
Sign in to reply
Verify Answer
Cancel