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
8 subscribers
Views
20324 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
Null value in Array
rohandhondilalk
over 8 years ago
Hi All,
Can any one help me in how to check a null value in an Array? , isNull(ri!abc), where abc is an Array. which not working as we expecting .
Quick response will be appriciated.
OriginalPostID-250480
Discussion posts and replies are publicly visible
Top Replies
sparshs
over 8 years ago
+1
you can do like this if(OR(rule!APN_isEmpty(ri!array),length(ri!array)=0)).
chetany
over 8 years ago
+1
A Score Level 1
If you want to just check if the array variable is itself null or Empty, you can use: or(local!myarray="", length(local!myarray)=0). This will work for any type of primitive array. If your array has few…
Parents
0
chetany
A Score Level 1
over 8 years ago
If you want to just check if the array variable is itself null or Empty, you can use:
or(local!myarray="", length(local!myarray)=0). This will work for any type of primitive array.
If your array has few elements which are null, you can also use the reject function.
Example: reject(fn!isnull, {1,3,2,null, 5}) . This will return {1,3,2,5}
isnull() does not work on arrays as expected as you observed - the reason is that sometimes an array maybe empty but not null, When an array is empty isnull() will return false. And it is common in SAIL UI to set array variables to null or empty list.
Either may happen, but in both the cases the isnull() behaves differently. It will be false for empty list, but true when it is actually null.
So, its better to avoid using isnull to check for nullability of array variables.
Cancel
Vote Up
+1
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
chetany
A Score Level 1
over 8 years ago
If you want to just check if the array variable is itself null or Empty, you can use:
or(local!myarray="", length(local!myarray)=0). This will work for any type of primitive array.
If your array has few elements which are null, you can also use the reject function.
Example: reject(fn!isnull, {1,3,2,null, 5}) . This will return {1,3,2,5}
isnull() does not work on arrays as expected as you observed - the reason is that sometimes an array maybe empty but not null, When an array is empty isnull() will return false. And it is common in SAIL UI to set array variables to null or empty list.
Either may happen, but in both the cases the isnull() behaves differently. It will be false for empty list, but true when it is actually null.
So, its better to avoid using isnull to check for nullability of array variables.
Cancel
Vote Up
+1
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data