Skip to main content

Notifications

Power Automate - General Discussion
Answered

Compare two SharePoint lists columns, create missing ID

(0) ShareShare
ReportReport
Posted on by 35

Hello everyone

I would like to compare two SharePoint lists, if the ID is missing in one table, this should be added with additional information.

 

I tried it with a loop but it doesn't work.

Schroeter_0-1667385403375.png

 

Best regards

 

Categories:
  • mahalakshmij_03 Profile Picture
    mahalakshmij_03 32 on at
    Re: Compare two SharePoint lists columns, create missing ID

    HI @grantjenkins ,

     

     

    Your solution is helpful for me also. but need one more help.. How to update for the Person or group,

     

    items('Apply_to_each')?['Requestor/DisplayName']  

     

    This above one is not working. Can you please help.

     

    Thanks,

    Maha

     

  • Schroeter Profile Picture
    Schroeter 35 on at
    Re: Compare two SharePoint lists columns, create missing ID

    Thank you. YEEEAAAH... . It works. I am happy, this milestone was still missing. THANK YOU VERY MUCH!

  • Verified answer
    grantjenkins Profile Picture
    grantjenkins 11,057 on at
    Re: Compare two SharePoint lists columns, create missing ID

    Ah OK - looks like the German translation for Body in this case is Text. I should have asked my son to translate as he's been learning German for a while now 🙂

     

    The Filter array won't give you individual properties as it doesn't have its own schema.

     

    You can reference each property you want to use with the following expression:

    items('Apply_to_each')?['NAME_OF_YOUR_PROPERTY']
    
    //Example:
    
    items('Apply_to_each')?['Category']

     

    Note that you might need to use your German translation for 'Apply_to_each'.

     

  • Schroeter Profile Picture
    Schroeter 35 on at
    Re: Compare two SharePoint lists columns, create missing ID

    Thank you for the Answer.

     

    I have not a Body.

    Schroeter_0-1667462472598.png

     

    Can it be due to too many entries or columns?

     

    Best regards

     

  • grantjenkins Profile Picture
    grantjenkins 11,057 on at
    Re: Compare two SharePoint lists columns, create missing ID

    I can see in your Apply to each you're passing in something with the name Text? It should be the Body of the Filter array.

     

    When you run the flow can you have a look at the output of the Filter array to see if it's returned your filtered results? I'd do this before adding the Create item just to check/confirm the filtering is working as expected.

  • Schroeter Profile Picture
    Schroeter 35 on at
    Re: Compare two SharePoint lists columns, create missing ID

    Hello, 

    Thank you very much.

    The solution was perfect. Until the elements are created.

    Schroeter_0-1667395175484.png

     


    I don't see the areas of filtering?

    Schroeter_1-1667395232847.png

    Schroeter_2-1667395262975.png

    I have in the right selection box no elements from the array filtering.
    As a result, he does not filter them out of me.

    Schroeter_3-1667395376261.png

     

    Thanks for the help.

     

    Best regards.

     

     

  • Verified answer
    grantjenkins Profile Picture
    grantjenkins 11,057 on at
    Re: Compare two SharePoint lists columns, create missing ID

    See example where it will return items from List A (Issues Register List) that don't exist in List B (Issues). I'm comparing List A internal ID field with List B Issue Id field. I'm not sure what you have but should give you what you need in terms of logic.

     

    List A (contains the full list of items)

    grantjenkins_0-1667390259118.png

     

    List B (only contains some of the items)

    grantjenkins_1-1667390314884.png

    Below is the full flow. I'll go into each of the actions.

    grantjenkins_2-1667390781599.png

     

    The first thing it does is get all the items from both lists.

    grantjenkins_7-1667391287704.png

     

    Select Issues IDs get a list of all the Issue Ids into an array using the following expression. Note that it also converts the values to int.

    int(item()?['IssueId'])

    grantjenkins_9-1667391529339.png

     

    In my case this will result in the following array.

    grantjenkins_4-1667390922235.png

     

    We then use Filter array to check if the items from Select Issues IDs do not contain the ID from List A. This will result in the Filter array only containing items from List A that are NOT in List B (based on the ids).

    grantjenkins_5-1667391034138.png

     

    value comes from Get items Issues Register

    Output comes from Select Issues IDs

    ID is item()?['ID']

     

    We can then use an Apply to each to iterate over the items in the Filter array and add what we want to List B. In my case I'm just adding the Title and ID from the items in the Filter array.

    grantjenkins_6-1667391254104.png

     

    The final result of List B (Issues) would be:

    grantjenkins_8-1667391429547.png

     

  • srduval Profile Picture
    srduval 1,663 on at
    Re: Compare two SharePoint lists columns, create missing ID

    Your problem might be that the logic of 1<>null doesn't evaluate to true. Try converting the ID from list2 into an if(empty(IDcolumn),0,idcolumn)

     

    *my formula might not work as written but should give you an idea of what to try.

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,475

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,767

Leaderboard