Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

How to you compare two sets of lists using the ID

I have two lists, compliance and Tarefas and i'm tryng to check if one of the lines in Complinace has been erased.

For that i have an array with the ID's of the elements of that list, and i'm tryng to compare with ListID that refers Tarefas with Compliance.

If the ListID on Tarefas are not present in Compliance it should delete that element.

I have used an for each and it works however it would delete all the elements on tarefas. 

Can someone help me?




Super User II
Super User II

Hi @Fmira,

You could use the filter array action with the does not contain operator. 


@DamoBird365 has written a nice blog about this approach. Look for the except section:


Below is an example using that approach.


In that example I am looking at the IDs of the both the lists and checking if Tarefas does not contain item IDs which Compliance has. In the from the output of the Select - Compliance action is used. For the comparison the following expression is used with the does not contain operator.


@not(contains(body('Select_-_Tarefas'), item()))



Unfortunately it doesn't work . 

It returns the three elements that i have but it only should return 1. The one with the ID 46



The output from the filter array.



The list tarefas.



The list compliance. The one with the ID 46 is A3.


What i'm trying to filter is to identify the ID 45 that was been deleted from the list compliance 


Super User II
Super User II

Hi @Fmira,


Apologies that I made it a bit confusing. In the example I showed I was checking the following:

Check if Tarefas does not contain item IDs which Compliance has


Looking at your original post the check probably needs to be reversed:

Check if Compliance does not contain item IDs which Tarefas has


So, in that case you need the swap the output values in the filter array action. In the from the output of the Select - Tarefas action. In the expression use the Select - Compliance output instead.




I have exchanged the values, however it should only give me the ID of 46. And it gives me the following ID's.


Thanks so much for the help so far

Super User II
Super User II

Hi @Fmira,


Can you share the outputs of the two select actions? Just want to double check something.

Hi @Expiscornovus . 
The outputs are the following:





Super User II
Super User II

Hi @Fmira,


The compliance array are integer values and your tarefas array are string values. That is probably the reason why it isn't working. You are comparing integers with string values.


Did you use a single line of text column type for the tarefas id field?

I did have as a single text column. 
However i did change to number and the error persist.



Super User II
Super User II

Hi @Fmira,


Thanks for changing that.


Just double checking a couple of things.

1. The select Tarefas action contains two list items, with ids 45 & 46. And the mapping is using the ListID field and not the ID field like in my example?

2. The select Compliance action contains three items, with ids 43, 45 & 46? 

3. You are expecting the filter array to give back 1 item, ID 43?

4. You are using the does not contain operator in your filter array?

1. The mapping is using ListID field because is matching the other list compliance.
2. Yes, A1, A2 and A3.

3. I'm expecting ID 46

4. I'm using does not contain.




Super User II
Super User II

Hi @Fmira,


If you are expecting item with id of 46 to be returned the current approach won't work. Because we just established that this id exists in both arrays.


Sorry, but I am honestly a bit confused now what you are trying to achieve. I thought you were trying to retrieve the items that didn't exist in the compliance list but which do exist in the tarefas list?

Hi @Expiscornovus 

That approach can also work, since i can delete those items later. What i'm trying to filter are the ones that are not in the list compliance in order to delete those tasks. 

Helpful resources

Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

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.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Users online (2,061)