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
Replies
11 replies
Subscribers
7 subscribers
Views
4265 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
I have requirement to read an excel sheet and validate the parsed fields.
saratrk
over 11 years ago
I have requirement to read an excel sheet and validate the parsed fields.
In that i need to validate a field whether it is a number or not. i did not find anything regarding this check with an expression (ie with expression editor / existing functions)
Also i need to check if the an emailaddress is valid or not. Plz let me know if anybody can help....
OriginalPostID-78813
OriginalPostID-78813
Discussion posts and replies are publicly visible
0
Alex Weller
Appian Employee
over 11 years ago
Sarat, the expression typeof() will tell you the Appian datatype but if you are parsing excel, I believe you will need to determine the type of the elements of each column beforehand. Please see the relevant shared component for more information on this.
You can write your own Appian expression to validate email addresses using a combination of Appian's useful Text Functions.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 11 years ago
saratrk,you could use typeof() or typename(typeof()) functions to check data types.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
saratrk
over 11 years ago
Hi alex and sikhivahans thank you both for your response.
typename(typeof()) is not working in my case. I read the excel file 'bill_amount' field in the text format. typename(typeof()) returns me text. if i convert the bill_amount to integer with toInteger() it returns number even if the value is "abcd" so i think i there is no other way than to write a custom function.
Let me know if there is any other way.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 11 years ago
@saratrk, one option is to have a regular expression which checks only for presence of numbers Usage of regexmatch with this expression returns true/false out of it. Still if you find any better way you can proceed with that.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
saratrk
over 11 years ago
i have searched in the forum and found
return (window.FormAPI.getValue("myTextField").id).match(/^[0-9]+(,[0-9]+)*$/)
used on the form for the same purpose.
But can i use match(/^[0-9]+(,[0-9]+)*$/) in the script task expression editor ?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 11 years ago
@saratrk, thats what i have said in the previous comment, use regexmatch() for this purpose. regexmatch("^[0-9]+(,[0-9]+)*$",ri!yourInputText). But Please note that this regular expression doesn't work (i think it checks only for numbers)for decimals as decimals contain point i.e. dot.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 11 years ago
@saratrk, still if you have any follow-up questions let me know.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
saratrk
over 11 years ago
just found regexmatch in the functions.will try on that. Thank you
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 11 years ago
ya ok
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
saratrk
over 11 years ago
regexmatch("^\\d+\\.?\\d*$", pv!inputText) is working for the integers as well as decimals. Thanks for your help.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
>