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
8 replies
Subscribers
7 subscribers
Views
3428 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
There is an issue with logical function "and" when used in expression
Vaibhav Tandale
A Score Level 1
over 7 years ago
There is an issue with logical function "and" when used in expression rule.
e.g. use below code in expression rule
fn!and(
ri!test1 = true()
ri!test2 = true()
)
Ideally, it should give syntax error as comma is missing after first condition. But SAIL designer does not throw any error and it evaluates the expression with wrong output
i.e. if inputs ri!test1 is true() and ri!test2 is false() in above expression rule then it gives output result as true() which is incorrect [correct output result is false()]
Now try below expression syntax (observe comma) which gives correct expected output result:
fn!and(
ri!test1 = true(),
ri!test2 = true()
)
My question here is about behavior of above expression (w/o comma):
Is this expected behavior in terms of checking for syntax errors? [not throwing error for missing comma]
If yes, please explain me how it is correct.
If no, then please consider it as a bug and fix...
OriginalPostID-218140
OriginalPostID-218140
Discussion posts and replies are publicly visible
0
Vaibhav Tandale
A Score Level 1
over 7 years ago
... it in future releases.
Please note same observations with fn!or as well. Observed on Appian version 7.11.
Thank you.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Karthik
over 7 years ago
I tried it in 7.11, I get the below error,
Expression evaluation error : Syntax error. Details: Expression evaluation error at function fn!and parameter 2: Lambda arguments not followed by ->.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Vaibhav Tandale
A Score Level 1
over 7 years ago
Hi Kartikeyan,
Please see attached screenshot with no error and wrong output.
Thanks.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Karthik
over 7 years ago
@vaibhavt308, I can also reproduce this. When we have rule inputs, it fails. Looks like there is a bug in Appian. You can raise a service ticket if its happening in live instances or you can code the fn!or and fn!and as it should be.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Tom Ryan
Appian Employee
over 7 years ago
Thanks for the feedback on our product. I agree this seems to be inconsistent behavior and will pass it on to our product team. In the meantime, the workaround to ensure correct evaluation will be to ensure to use the comma.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
PhilB
Certified Lead Developer
over 7 years ago
I would argue that you're using booleans incorrectly; shouldn't your expression be:
fn!and(
ri!test1,
ri!test2
)
...? Not sure that would fix your issue, but it's certainly a bad habit to use constructs like if(<boolean> = true - they're booleans for a reason! :)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
shivakanthr
over 7 years ago
@cvaibhav,
Even i observed the same thing in 16.2 as well. Even i am not getting the error if i dont use COMMA between two conditions. But the thing i observed is if we dont put COMMA between two conditions, its considering only the first condition and returning result of that condition.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Vaibhav Tandale
A Score Level 1
over 7 years ago
@Tom Thanks for taking this to product team. Workaround is already provided, however it took long time to find out missing comma was the culprit for wrong output.
@Philb This is just sample example given to understand the problem. Use any expression/condition you want.
Thanks
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel