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
20303 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…
0
rishub
over 8 years ago
please Try rule!APN_isEmpty
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 8 years ago
@rohandhondilalk Maybe worth applying a length(ri!array)=0 as secondary level check?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Mike Schmitt
Certified Lead Developer
over 8 years ago
In case you mean you want to find a null value in an array of other data, you can use a combination of where() and apply(), as in the following example code:
with(
array: {"a", "b", null(), "d"},
where(
apply(fn!isnull, array)
)
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sparshs
over 8 years ago
you can do like this if(OR(rule!APN_isEmpty(ri!array),length(ri!array)=0)).
Cancel
Vote Up
+1
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Rama Thummala
Certified Lead Developer
over 8 years ago
You can check by using below code....
if(or(isnull(ri!array),length(ri!array)=0),true statements, false statements )
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
chandu
A Score Level 2
over 8 years ago
if you want just to have true or false for null value in array can't we use
any(fn!isnull,arrray)?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
rohandhondilalk
over 8 years ago
@sikhivahans, we had applied and it was working at run time. When we had implemented the same in the designer mode, it was not working as expected.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
rohandhondilalk
over 8 years ago
Hi ramanjaneyulut, Thanks !!. It worked . :)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
rohandhondilalk
over 8 years ago
@chandrasekharg, @rishub, @mschmitt, @sparshs, @sikhivahans : Thank you all for the response .
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
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
>