intersection and union function for arrays #2155
nahiyan-yasaar-selise
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
To generate certain reports we are generating an html table but have to rely on triple nested loops. The generation involves both user input (multivalue) and checking the data source for whether records exist for that selection. For example: User selects in a prompt values A to P, but in the data source module, what exists are only records with values G to Z. Because of this, the nested loop still has to loop A to F just to check if data exists or not. This is unoptimal.
The solution involves two independent steps:
Ideally, assuming we have an array of existing values (G-Z), the intersection expression should return an array of values G-P so that we are only looping through G-P.
We did dedicate a portion of the workflow to manually figure out this intersection, but relying on this all the time is prone to errors.
Expression --> Desired output:
newArr = intersect(newArr, ["A", "B", "C", "D"], ["C", "D", "E"])-->newArr = ["C", "D"]newArr = union(newArr, ["A", "B", "C", "D"], ["C", "D", "E"])-->newArr = ["A", "B", "C", "D", "E"]Beta Was this translation helpful? Give feedback.
All reactions