web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to you compare two...
Power Automate
Unanswered

How to you compare two sets of lists using the ID

(0) ShareShare
ReportReport
Posted on by

Hello,
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?

 

Fmira_0-1623938430874.png

 

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @Anonymous,


    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:

    https://www.damobird365.com/efficien-union-except-and-intersect-great-method/

     

    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()))

     

    compliance.png

  • Community Power Platform Member Profile Picture
    on at

    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

     

    Fmira_0-1624546856312.png

    The output from the filter array.

     

    Fmira_1-1624546913717.png

    The list tarefas.

     

    Fmira_2-1624546945378.png

    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 

     

  • Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @Anonymous,

     

    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.

     

    filterarray_example.png

     

  • Community Power Platform Member Profile Picture
    on at

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

    Fmira_0-1624550885278.png

    Thanks so much for the help so far

  • Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @Anonymous,

     

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

  • Community Power Platform Member Profile Picture
    on at

    Hi @Expiscornovus . 
    The outputs are the following:

    Fmira_0-1624551782649.png

     

    Fmira_1-1624551803691.png

     

  • Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @Anonymous,

     

    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?

  • Community Power Platform Member Profile Picture
    on at

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

    Fmira_0-1624553016542.pngFmira_1-1624553043868.png

     

  • Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @Anonymous,

     

    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?

  • Community Power Platform Member Profile Picture
    on at

    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.

     

    Fmira_0-1624564603933.png

     

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.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard