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

Community site session details

Session Id : mP+y28XnjMMYVJvMCvH6ZD
Power Automate - Using Flows
Answered

Lookup a value in power automate

Like (0) ShareShare
ReportReport
Posted on 31 Oct 2022 07:09:09 by 39

Hi,

I have a flow that gets data via an HTTP step.
The output includes several fields where my interest is in two fields: URL, and group ID:

Moshema_0-1667199923933.png

 


I have an excel and in the excel I have a column with the URL.

Moshema_1-1667199981615.png

 

I want to check in the JSON the URL from excel and if it finds it to receive the group ID and if not to do something else.

I'll really appreciate it if someone can help me.



I have the same question (0)
  • Verified answer
    grantjenkins Profile Picture
    11,059 Moderator on 31 Oct 2022 at 08:03:58
    Re: Lookup a value in power automate

    I'd suggest using a Filter array on the locations array in your JSON.

     

    In my example I've assumed you are looping over each of the rows in your Excel file.

     

    See my example below. I'll go into each of the actions.

    grantjenkins_1-1667202348691.png

     

    Compose just contains a sample of your data you retrieve from HTTP. And Parse JSON gets me nice properties I can refer to. You can skip these steps as you already have your data.

    grantjenkins_2-1667202819432.png

     

    List rows present in a table gets my Excel data.

    grantjenkins_3-1667202860907.png

    My Excel data for this example has the following:

    grantjenkins_4-1667202900209.png

     

    Next, I use an Apply to each to iterate over each of the rows from Excel. I then have a Filter array that takes in the locations array from my Parse JSON action and filter on url is equal to Location (from the current row)

    grantjenkins_5-1667203009020.png

     

    This will return a filtered array of objects where the url matched. We can then use a Condition to check if the length of the Filter array is greater than 1, and apply the appropriate actions for true or false.

     

    The expression to get the length of the array is:

    length(body('Filter_array'))

     

    grantjenkins_6-1667203195750.png

     

    If you then wanted to extract out the group Id from the Filter array you could use a first expression as we assume it's only returned a single result, but still an array.

    first(body('Filter_array'))?['groupId']

    grantjenkins_8-1667203342233.png

     

    Hope that helps and is what you were after.

  • Moshema Profile Picture
    39 on 10 Nov 2022 at 11:20:53
    Re: Lookup a value in power automate

    @grantjenkins  amazing, thank you.

     

    Just a little question from where do you take the group ID

    in 

    first(body('Filter_array'))?['groupId']
  • Verified answer
    grantjenkins Profile Picture
    11,059 Moderator on 10 Nov 2022 at 11:26:52
    Re: Lookup a value in power automate

    The Filter array will contain all the properties from your JSON including the groupId.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Tom Macfarlan – Community Spotlight

We are honored to recognize Tom Macfarlan as our Community Spotlight for October…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 707 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 499 Moderator

#3
chiaraalina Profile Picture

chiaraalina 312

Last 30 days Overall leaderboard

Featured topics

Restore a deleted flow
Loading complete