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 / Get Items Filter Query...
Power Automate
Unanswered

Get Items Filter Query - Multiple Conditions with If Statement

(0) ShareShare
ReportReport
Posted on by 1,044

Happy Holidays.

I'm attempting a Get items filter query such as:

  • A Field eq '{whatever was selected in automatic trigger input}' and (if another input field eq 'Yes', make a field Tune0/Textlisttxt eq 'Yes' otherwise/else, make (Tune0/Textlisttxt  'Yes' or make Tune0/Textlisttxt  'No')) i.e.: it s
  • The following works fine since there is no 'if' statement:
  • (Band eq '@{triggerBody()['text']}') and (Tune0/SetListtxt eq 'Yes' or Tune0/SetListtxt eq 'No')

 

 

  • BUT!!! That second part is not taking into consideration the second input trigger requirements yet. (See attachment of flow)
  • The second input parameter is triggerBody(['text_11']). Then, I've set a variable to return:
    • 'Yes' if Set list only is choosen,
    • 'No' if All music is chosen
    • Here's the variable: 
    • if(equals(triggerBody()['text_1'],'Setlist only'),'Yes','No')​

 

 

  • So, in the Filter Query, I've tried to implement the if statement to handle the logic but iot keeps failing and after many different configurations, can't find what is wqrong with my syntax. Here is what I've tried that makes most sense (to me 🙂)
  • (Band eq '@{triggerBody()['text']}') and (Tune0/SetListtxt eq '@{if(equals(variables('Music'),'Yes'),'Yes',Tune0/SetListtxt eq 'Yes' or Tune0/SetListtxt eq 'No')}')

Any assistance would be greatly appreciated.

NOTE: I tried at add the code as javascript but posting kept returning an error about bad HTML (?????). I think I've had enough errors for one day.

 

Thanks

Categories:
I have the same question (0)
  • grantjenkins Profile Picture
    11,063 Moderator on at

    It looks like you're just trying to do the following:

     

    Band eq '@{triggerBody()['text']}' and Tune0/SetListtxt eq '@{variables('Music')}' 

     

    grantjenkins_0-1671926470127.png

     

    If that's not what you're after, then let me know.

  • CW Profile Picture
    1,044 on at

    Hi Grant. 

     

    Almost. The variable only returns 'Yes' and 'No'. It'd need to be either 'Yes' or 'Yes' and 'No' as well as the 'and' Band. 

    That's why mine seems needlessly complicated. 

     

    So (Band eq Input) and (setlist eq yes if the Expression is yes otherwise setlist eq yes and/or no)

  • Verified answer
    grantjenkins Profile Picture
    11,063 Moderator on at

    Can you try the following. If Music is set to No it will return items that are not equal to null - which means it should return both Yes and No (all items).

     

    (Band eq '@{triggerBody()['text']}') and @{if(equals(variables('Music'), 'Yes'), '(Tune0/SetListtxt eq ''Yes'')', '(Tune0/SetListtxt ne null)')}

     

  • CW Profile Picture
    1,044 on at

    Will try that on Christmas day Grant thanks. That looks so similar to what I had, I'm going to have to pull it apart to see where I went wrong.

    I'll respond to you tomorrow. AS USUAL, thanks for the help. You have no idea how helpful you have been!!!!!.

     

    Carl

  • CW Profile Picture
    1,044 on at

    😄That worked nicely, thanks Grant. Great idea with the ne null!! It's hard when you're so subjective. Looking from the outside now it makes sense but yes, my syntax was a bit 'off'. I made the expression too complicated. 😬

     

    Cheers, Happy Holidays🎄

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

#2
Tomac Profile Picture

Tomac 406 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard