cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Erick
Advocate III
Advocate III

Issue with contains filter

 
6 REPLIES 6
rrovira
Microsoft
Microsoft

Hello, @Erick!

 

Could please provide us with a little bit more information? Perhaps some screenshots or an error message? 

 

Thanks you in advance! 

 

Cheers,

Rodrigo!

Hello Rodrigo,

It's very weird and I succeeded finding a workaround. Let me explain:

I have 2 arrays of objects and I want to find what items in the 2nd array exist in the 1st array.

I know it can be done using 'Apply to each' but it can take time depending on the number of items in the arrays.

Consequently I tried using the 'Filter array' action with 'contains'.

In the From field I put the 1st array (Output) and under: 2nd array (varBestUsers) - Contains - item().

Erick_0-1631710512975.png

Unfortunately it doesn't work: nothing is found.

However I found a workaround to make it work:

I replaced item() by:

json(concat('{ "UserID":', item()?['UserID'], ',"InteretID": ', item()?['InteretID'], '}'))
Erick_1-1631710795602.png

 

Can you explain why item() doesn't work and it does with the JSON clause doing the same thing?
Thanks++
ScottShearer
Super User III
Super User III

@Erick 

I believe that your issue could have been solved by using a union() expression.

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

@ScottShearer Can you tell me how to use union in my case?

@Erick 

Sorry, I should have said intersection() and not union()

My understanding is that you want to find the common elements between two arrays:

image.pngimage.pngimage.png

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Erick
Advocate III
Advocate III

Hi @ScottShearer, Thanks for your response. In fact intersection or contains functions only works with strings and not numbers (after Select or Get items). Once I converted all numbers to strings it eventually worked.

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,687)