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
18 replies
Subscribers
7 subscribers
Views
8972 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
Is there a way to convert a String to evaluable SAIL expression ? I
Raj Yadla
over 9 years ago
Is there a way to convert a String to evaluable SAIL expression ?
I have a comparative expression saved in a database field, I need to retrieve it from the database and evaluate it within a condition in SAIL.
OriginalPostID-137948
OriginalPostID-137948
Discussion posts and replies are publicly visible
Top Replies
jackm829
over 9 years ago
+1
A Score Level 3
You could try eval(). My understanding is that this is an undocumented function. You will have to test to make sure that it works with your Appian version. Example: eval("count({1,2,3})") returns 3. In…
Raj Yadla
over 9 years ago
+1
Thanks all ,eval() did the trick for me.
0
William Ruck
A Score Level 3
over 9 years ago
Could you give an example of the kind of comparative expression you mean? Do you mean you are storing a literal SAIL expression (e.g. an a!gridField) in the database, and want to have it evaluate?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Mike Schmitt
over 9 years ago
What is the variety of different comparative expressions you might have saved in the database field? If it's finite and relatively few, you could always evaluate the string in an IF() statement and then perform the appropriate expression depending on how the IF() evaluated...
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Raj Yadla
over 9 years ago
In DB i would have conditions such as value>4 or len(value)=2 or even an regular expression , the value will be a local variable or a pv which is defined in the interface where i use this .
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Raj Yadla
over 9 years ago
@mschmitt : its not finite and also the requirement is to have it dynamic , the usage of nested if doesnt serve our purpose to be able to add new conditions
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Josh
Certified Lead Developer
over 9 years ago
Why not just evaluate your conditions in Appian? What is the use case for storing expressions directly in the database?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
William Ruck
A Score Level 3
over 9 years ago
That's what I was afraid of. Appian does not support the interpretation and execution of strings as SAIL expressions. If you are building conditions dynamically or such that they are very situation dependent, a series of nested rules that encompass your logic would be appropriate.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Mike Schmitt
over 9 years ago
Per what others have said - if it absolutely has to be done this way, other than designing some new plugin to interpret the text commands, all I can think of personally would be to break up the text expressions into separate pieces and evaluate them via conditional statements (which would be difficult). You'd have to have a well-defined business rule regarding what format the expressions could have (i.e. the operators they could handle, the length, etc), but the plus side is that the evaluation rule could always be expanded in the future to handle more things.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Raj Yadla
over 9 years ago
@joshl : The usecase is to perform validations on the sail components(textfields,dropdowns..) which are created dynamically with an entry in the DB..these validations also have to be dynamic which is given in a DB so that it accomodates any new validations or even reg ex.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Raj Yadla
over 9 years ago
@mschmitt : we could define an exclusive list of operators ,but then if anything new arises we may need to change the code also the expectation is it should handle reg ex which we may not do by segregating the condition
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
jackm829
A Score Level 3
over 9 years ago
You could try eval(). My understanding is that this is an undocumented function. You will have to test to make sure that it works with your Appian version. Example: eval("count({1,2,3})") returns 3. In your case, you may want to have an expression rule with a text input with the expression, and use eval(ri!input) as the rule definition.
Cancel
Vote Up
+1
Vote Down
Sign in to reply
Verify Answer
Cancel
>