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 / Intersection Expressio...
Power Automate
Answered

Intersection Expression Showing Blank on Input

(0) ShareShare
ReportReport
Posted on by 59

I have build a flow where I am looking to compare two array variables but when I run the intersection expression, it appears that the input and output are both an empty array.  I don't understand how it is possible but any help would be much appreciated.

 

2021-12-20_10-27-54.jpg

Categories:
I have the same question (0)
  • Verified answer
    v-xiaochen-msft Profile Picture
    on at

    Hi @bsmith736464 ,

     

    This shows that these two collections do not have common items.

    vxiaochenmsft_0-1640224029036.png

    vxiaochenmsft_1-1640224411441.png

    vxiaochenmsft_2-1640224430383.png

     

     

    Best Regards,

    Wearsky

     

  • NaufalP Profile Picture
    75 on at

    Hello!

    I know this is an old thread but wanted to revive this since I'm facing similar issues. I have to 2 arrays of objects variable with the same key in both of them, one is generated by excel and one is from sharepoint.

     

    When I used the intersection expression it return an input and output of empty..

    Is there something I'm missing? I've been trying to figure it out for days.

     

    Var 1

    NaufalWahika_1-1672829727673.png

    Var 2

    NaufalWahika_2-1672829754809.png

     

    Intersection Action

    intersection(variables('var_IDSPO'),variables('var_IDEXCEL'))

    NaufalWahika_0-1672829702992.png

     

  • Priddo Profile Picture
    6 on at

    Hi NaufalWahika, did you get anywhere on this? I am facing a similar issue. I have 2 arrays to compare but get a [ ] result with intersection(). However, when I compare manually (intersection with pasted outputs) it works!

  • NaufalP Profile Picture
    75 on at

    Hi @Priddo ,

    To be honest I posted this a long time ago and didn't remember what I did (I probably found another way of doing),

     

    But I recreated the flow and it's working as expected now, could've been a bug back then and was fixed by Microsoft.

     

    NaufalWahika_0-1717554285794.png

     

    NaufalWahika_1-1717554331022.png

    intersection(variables('var1'),variables('var2'))

     

    Could you share from your side what the issue is? 

     

    Thank you,

    Regards,

  • Priddo Profile Picture
    6 on at

    Hi NaufalWahika,

     

    Thanks for coming back to me so quickly!

     

    I found the route of my issue after a lot of trial and error! Intersection() only gave me results if the fields were strings! I had a mixed data type of integers/numbers, boolean and strings. Took me a while to figure out!

     

    Use case:

    I am synchronising 2 lists - Microsoft Todo and a SharePoint list. This is to enables me to use custom fields and reports and also benefit from the integration of MS Todo!

     

    To sync from SP to Todo, I have used an event driven flow... all fine. To sync the other way (Todo to SP), I think the only option I have is to schedule a flow that looks for differences between the data sets and updates the records accordingly.

     

    Solution:

    I prepare an array for all the open tasks in SP. I then prepare an array containing all the open tasks (or completed in less than a day) in Todo along with the SharePoint ID to the corresponding SP record using xPath. If this information is missing, I add a new list item to SP. For all "exsiting" records, I use an intersection() to find the common records. I then use a Select function on the Todo List with the addition of xPath (counting common records) to identify which records need updating in SP (records with zero count)! This means I do not need an "Apply to each" (until I get to the Sharepoint… yet to work out batch editing / adding of sharepoint records).

    There are a few other bits I need to do in the process and happy to share if you (or anyone else) are interested.

     

    Snippets:

    xpath(xml(outputs('Compose_JSON')),concat('number(/root/tasks[TodoID="',item()?['id'],'"]/SPID)'))

    intersection(body('Select_T2'),body('Select_T1'))

    xpath(xml(outputs('Compose_Matching_Tasks')),concat('count(/root/tasks[TodoID="',item()?['TodoID'],'"])'))

     

    Kind regards,

    Priddo

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 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard