Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

How to create a string from a unique array record

(0) ShareShare
ReportReport
Posted on by 364

Hi All, 

 

I have a flow that checks the records in 2 different arrays, and then sends an email if any of the records in either array are not present in the other. I use Union(variables('varListA'),variables('varListB')) to combine the arrays, and then compare the lengths to see if there are any differences. 

 

What I would like to do is pull a string value for the any records that are present in the first array, but not the second. So if 11 out of 12 records in both arrays match, I would like to create a string value for the 12 record so I can then email information on it to the proper person.

 

Aurora_0-1678139171832.png

 

varListA and varListB are my 2 arrays, and they always have 12 records in them. Any number of records could be different when the flow runs, but typically it would be one. Does anyone have any suggestions for how I could try to pull these specific records from varListA? 

  • Chriddle Profile Picture
    7,791 Super User 2025 Season 1 on at
    Re: How to create a string from a unique array record

    Use Filter action with contains function on ArrayA

    Chriddle_0-1678193940300.png

     

  • Verified answer
    grantjenkins Profile Picture
    11,059 Super User 2025 Season 1 on at
    Re: How to create a string from a unique array record

    Hopefully this is what you're looking for.

     

    varListA contains the following data.

    [
     {
     "Name": "Sample 1",
     "Amount": 110
     },
     {
     "Name": "Sample 2",
     "Amount": 200
     },
     {
     "Name": "Sample 3",
     "Amount": 200
     }
    ]

    grantjenkins_2-1678192782387.png

     

    varListB contains the following data.

    [
     {
     "Name": "Sample 1",
     "Amount": 110
     },
     {
     "Name": "Sample 3",
     "Amount": 200
     },
     {
     "Name": "Sample 4",
     "Amount": 250
     }
    ]

    grantjenkins_1-1678192767332.png

     

    The highlighted items are missing from the other array. For example, Sample 2 is in List A but not in List B, and Sample 4 is in List B but not in List A.

     

    Filter array List A will return items in List A that are not in List B.

    grantjenkins_3-1678192910782.png

    grantjenkins_6-1678193480407.png

     

    Filter array List B will return items in List B that are not in List A.

    grantjenkins_4-1678192940395.png

    grantjenkins_7-1678193504931.png

     

    Compose uses a union expression to join the items from Filter array List A and the items from Filter array List B, giving us a list of all the items that are different across both arrays. The expression used is:

    union(body('Filter_array_List_A'), body('Filter_array_List_B'))

    grantjenkins_5-1678193028960.png

    grantjenkins_8-1678193590945.png


    ----------------------------------------------------------------------
    If I've answered your question, please mark the post as Solved.
    If you like my response, please consider giving it a Thumbs Up.

  • Aurora Profile Picture
    364 on at
    Re: How to create a string from a unique array record

    @v-xiaochen-msft 

     

    Both arrays should look like this: 

    Aurora_0-1678191774131.png

    Aurora_1-1678191850212.png

     

     

    An example of the use case I'm interested in would be if the value for part number "431-450-8013" increased from 4 to 5 in varListA, but not varListB. I'd then send an email that details the increase for that part number. Please let me know if I need to do a better job of explaining.

     

  • v-xiaochen-msft Profile Picture
    on at
    Re: How to create a string from a unique array record

    Hi @Aurora ,

     

    Could you provide the sample array data?

     

    Best Regards,

    Wearsky

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >