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 / Using a condition to c...
Power Automate
Unanswered

Using a condition to check if a value is contained in an array

(0) ShareShare
ReportReport
Posted on by 20
I'm creating a flow which takes the entries from List A (Power BI report) and populates List B (SPO list), but only if the list item does not already exist on List B. On both lists there a is an 'ID' column which is always unique. 
 
In my flow I have queried both lists:
 
In 'Select - GUIDs', I map the ID column value to a key named 'GUID'.
 
After the above, the outputs from the 'Parse JSON - First table rows' are in a 'For each'. Within this, a new item is created in List B.
 
Before doing this however, I'm trying to apply some logic to ensure it does not create an entry which is already there. I tried doing this by setting a condition with the following expression:
Select - GUIDs does not contain For each ID column
 
However for each instance of the flow, the expression keeps evaluating to true and it keeps creating duplicate items. I've also tried adding in a 'Compose and using the 'Contains' function, but it always comes out the same.
 
Can anyone advise what I'm doing wrong here? Also, if there is a better/more efficient approach to doing this? The reason I've tried doing it this way is because I thought it would be more efficient than querying the SPO list each time in the 'For each'.
 
Thanks
 
 
Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    68,739 Most Valuable Professional on at
    I think the problem is that the ID entry in each data source is specific to that data source. So doing a compare on the IDs is never going to find the same ID in both lists.  There should be something else unique in the lists that matches between the two data sources, for example the Title in the SharePoint list. You'll need to find that and compare those.
     
    If you are storing the GUID column generated by Power BI in the SharePoint list that might be another way to identify an existing row.  But that would depend on whether the ID in Power BI is coming from the original data or being generated in the report.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • h-demedici Profile Picture
    20 on at
    Thanks @Pstork1 for your response. This was my bad in the wording I used for this post.
     
    On both tables they are seperate columns. On the Power BI report it is called 'ID' which contains the GUID of a Microsoft Team, in the SPO list, the column is called 'GUID'. On both tables, the values are formatted as text.
     
    There is no relation/link to the native 'ID' column in the list on the SPO site.
  • Pstork1 Profile Picture
    68,739 Most Valuable Professional on at
    So when the flow creates an item the first time it transfers the GUID value from the Power BI report and stores that in the list?  When the report runs again does Power BI report the same GUID value or is a new one generated?
     
    Can you provide a screenshot of the condition statement you are using and how it relates to the ForEach?

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • h-demedici Profile Picture
    20 on at
     
    Q1: Yes
    Q2: Same GUID value (and if it is the same becaue the list item already exists is List B, then I don't want the flow to do anything else, so trying to use this bit in the condition)
     
     
    The 'For each' is based on the outputs from the Power BI dataset query ("@outputs('Parse_JSON_-_First_table_rows')['body']")
     
    For the condition, this is configured for 'Select - GUIDs' does not contain 'ID' for the current for each item.
     
    Having been experimenting more, I've got my intended outcome to work by adding the 'Get items' query inside the For each and doing a filter based on the ID of the current item. Although I plan to have this workflow running daily overnight, the outputs from the Power BI dataset query are likely to be no more than 5 per instance of the workflow running. I'd still class myself as a novice to Power Automate, so not sure if this would be considered best practice, or I should revert to the orignal approach I was using (if I can get it to work).
     
    Thanks

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

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard