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
3 replies
Subscribers
8 subscribers
Views
3293 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
Does anyone have a good method to find a blank value in an local array? I like
danielh754
over 9 years ago
Does anyone have a good method to find a blank value in an local array? I like to write complex SAIL rules using lots of local variables and arrays. My biggest headache is that touniformstring() doesn't appear to behave as described in documentation.
Documentation says "Converts a value to Text, preserving the original scalar or array structure." Yet as you can see in the image it REMOVES blanks from an array. Has anyone else noticed this? I'm writing a lot of complex rules that heavily use local variables and array with indexes. Therefore I use wherecontains() frequently. wherecontains() requires that both parameters be of the same type so I often convert one or both parameters to text (or relevant type).
Note: I'm in Appian 7.5
OriginalPostID-149282
OriginalPostID-149282
Discussion posts and replies are publicly visible
0
Amitkumar
over 9 years ago
Try this one to find blank value in an array
fn!wherecontains(tostring(""),apply(fn!tostring,{2,"",1,""})) --> 2;4
Length function does not consider null values while calculating length of the input. You can use count function to get exact number of elements including null values.
count(apply(fn!tostring,{2,"",1})) --> 3
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
danielh754
over 9 years ago
That worked. Thanks
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Tom Ryan
Appian Employee
over 9 years ago
To clarify regarding the behavior of touniformstring(), here it seems to stem from a combination of the way Appian handles arrays and the use of apply(). Appian flattens nested arrays in slightly different ways depending on the base data type, and the output of apply() is flattened as well. Your example is complicated by apply() returning Any Type; if you create an array of strings similarly to the way Amit described above, touniformstring() preserves the blank element. Hope that helps.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel