Say that I currently have a list {A, B, C, D, E} and that I want to take the intersection of A n B n C n D n EHow can I do this? I can't think of a way to extract the sets from the list in a way that would allow me to take an overall intersection.[EDIT]It seems I was unclear about what I needed and for that I apologise. Though this specific example only has five sets, I need a method that works for any number of sets. This was my fault for not making it explicitly clear. Further, I believe the intersection function will not work, since if I don't know the length of the list of sets, I cannot retrieve them individually, and hence I cannot put them into the intersection function, even though it can handle multiple sets. Apologies to everyone who has taken the time to submit an answer to the specific case in the question.
Discussion posts and replies are publicly visible
Take a look at repeat(), joinarray() and concat() functions. You need to play around this and try out.
Im sorry I still haven't been able to find an approach that works, can you give me more specific advice?
Can you give me the sample input values and expected result (output), in that way, I will be able to provide you more specific solution. Thanks!!
Think of a data structure, say a tree.
Convert your set A into a tree then do a scan of all other branches for common element like in the implementation of a sort algorithm.
Simply, loop through every element of only one of the for sets. Reason; the mathematical law of set intersect states that every intersect element amongst nth number of sets exist in each of the sets.
So, you have a nexted loop.
For each element in set A
Loop through all other elements of the other sets
B, C & D for existence.
If found in all the sets, then it's an intersect element.
Next
Your problem is centered around mathematics and algorithm, try to read up.
Don't forget to upvote. Feel free to follow me. If you have any questions feel free to contact me as well.
If you need guidance on your project, I am available as well.
Good luck!
You can use appian intersection function. For more help refer https://docs.appian.com/suite/help/19.3/fnc_set_intersection.html
To expand on this - you can use the intersection function with more than two parameters. So if you add an intersection with all sets, it should give you the correct result:
a!localVariables( local!variable1: {"a", "b", "c"}, local!variable2: {"a", "c", "d"}, local!variable3: {"a", "f", "g"}, local!variable4: {"a", "e", "h"}, intersection(local!variable1, local!variable2, local!variable3, local!variable4) )
Hey Dannyh0001, seams Appian already has an in-built function for you. Go for it, but if your set is heterogenous it will fail you.