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
5 replies
Subscribers
8 subscribers
Views
2861 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
Has anyone else noticed a change in how the wherecontains function works? S
Jin Pheh
Certified Associate Developer
over 10 years ago
Has anyone else noticed a change in how the wherecontains function works?
Specifically if I am searching for repeated values the wherecontains now removes duplicates from the results where it used not to.
Eg:
wherecontains({a, b, a}, {a, b, c})
I expect this to return [1, 2, 1] however it now returns [1, 2].
If this is the desired behavior does anyone know how I might get the first result (IE: [1, 2, 1]) short of using an apply function? (I'm manipulating large arrays and I'd prefer to use a set function instead of an iterative one)...
OriginalPostID-128856
OriginalPostID-128856
Discussion posts and replies are publicly visible
0
Eduardo Fuentes
Appian Employee
over 10 years ago
- Just tested in all versions from 6.6.0 to 7.7 and it has always worked this way, without duplicates in the result.
- I don't' have any other set function in mind that would help in this case on top of my head but can you describe the use case to see if there's another option other than looping?
I'll also let other throw out ideas on this one, but wanted to clarify that the behavior has been the same since the beginning of this function to avoid confusion
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Jin Pheh
Certified Associate Developer
over 10 years ago
Very interesting - That goes against my experience as I've used it extensively in 6.5, 6.6 and 6.7 and it's never removed duplicate results from the result set before.
My use case is that I have a large list of Id's and I need to get a corresponding object for each ID. Because there are only ~30 objects and they live in the database I wanted to use the wherecontains and index function to transpose the ids into the objects via:
index(objectArray, wherecontains(keyList, objectArray.Id), null())
I've used this successfully in many situations and have even created an expression rule to use this recipe in shorthand.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
ganeshl
over 10 years ago
use this: apply(wherecontains(_, {a, b, c}), {a, b, a})
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
ganeshl
over 10 years ago
copy paste this and hit Test Rule button in rules editor: =apply(wherecontains(_, {"a", "b", "c"}), {"a", "b", "a"})
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Jin Pheh
Certified Associate Developer
over 10 years ago
Thanks Ganesh. I actually ended up using an apply with displayValue instead but that would definitely work as well.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel