Skip to main content

Notifications

Power Automate - Building Flows
Answered

Power automate Odata filter

(0) ShareShare
ReportReport
Posted on by

One of my Power Automate flow is connecting to Dataverse with tables

TableA

               TabACol1

               TabACol2

TableB

               TabBCol1

               TabBCol2

               TabbCol3

Flow Trigger

When a record is created or modified in the custom table A

 

One of the actions in this flow lists rows from table B. I want to limit the fetched rows from table B instead of applying the condition on each record in the loop. Looking to implement an Odata filter similar to following

 

(TabBCol1 eq ‘XYZ’ and TabACol1 eq ‘A’) or (TabBCol2 eq ‘ABC’ and TabACol1 eq ‘B’)

 

(nb: Based on the value of TabACol1 in the trigger record I want to check either column TabBCol1 or column TabBCol2 of table B

It seems the Power Automate ‘List All Rows’ action allows the Odata filer but that always looks for the column name of the table on the left side of “eq” operator.

Any suggestion to achieve this will be helpful as my Table B has a very large number of records and fetching all records and checking ion the loop may not be very efficient.

 

 

  • Verified answer
    grantjenkins Profile Picture
    grantjenkins 11,057 on at
    Re: Power automate Odata filter

    Not sure if this is what you're looking for but think it will work.

     

    I'm using the following two tables.

    grantjenkins_0-1678871640376.png

     

    grantjenkins_1-1678871743349.png

     

    See full flow below. I'll go into each of the actions.

    grantjenkins_2-1678871773978.png

     

    I'm assuming this is the trigger you are using for TableA.

    grantjenkins_3-1678871808626.png

     

    List rows uses the following expression to build up the filter.

    //You'll need to change the column names to match what you have in your tables
    
    //'cra85_tabbcol2 eq ''NOMATCHES''' is used if no matches to ensure we don't get any results
    
    if(
     equals(triggerOutputs()?['body/cra85_tabacol1'], 'A'),
     'cra85_tabbcol1 eq ''XYZ''',
     if(equals(triggerOutputs()?['body/cra85_tabacol1'], 'B'),
     'cra85_tabbcol2 eq ''ABC''',
     'cra85_tabbcol2 eq ''NOMATCHES'''
     )
    )

    grantjenkins_4-1678871954361.png

     

    I'm then using a Select to see the actual output from List rows.

    grantjenkins_5-1678871996030.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.

  • StretchFredrik Profile Picture
    StretchFredrik 2,610 on at
    Re: Power automate Odata filter

    I only think that ODATA filters can filter based on the list itself, so you cannot incorporate listB in the odata filter for listA. You need to get all the items in that case and filter it afterwards via the filterarray step. 

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,445

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,741

Leaderboard