Announcements
Hi Folks,
I'm trying to compare two collections in canvas app:
Collection A:
Collection B:
I need to compare these two collections and return true if at least one of the IDs in Collection A is present in Collection B. Is there anyway I can compare this without using ForAll in canvas app?
Hi @rbn_nue ,
May I ask why ForAll can't be used?
The only other way I can think of is by using recursion, but that is more complicated to build.
Hi @BCBuizer
The number of both rows in real time scenario is much higher. Just trying to best method without slowing down the app.
Thanks.
Please try the below to see how the performance is. For me it responded quite quickly on two collections that had 1000 items each.
Sum( ForAll( 'Collection A'.ID, If(ThisRecord in 'Collection B'.ID, 1,0) ), Value )>0
I had already used forAll and it was quite fast. But looks like the code you provided is much more optimized. Will try this and let you know.
Thank you.
Yes, you can use the Filter function to accomplish this without using ForAll. Here's an example formula that should work: CountRows(Filter(CollectionB, OfficeGroupID in CollectionA.ID)) > 0 This formula uses the Filter function to create a new collection containing only the items in CollectionB where the OfficeGroupID is present in CollectionA.ID. The CountRows function is then used to count the number of items in this filtered collection. If the count is greater than 0, it means at least one ID from CollectionA is present in CollectionB. The formula returns true in this case, and false otherwise.
Hi @rswain
That worked! Thank you for the suggestion.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our community stars!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
11manish 360 Super User 2026 Season 2
M Bilal Khan 325
Mohsin Ali 232