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 / Multiple values to loo...
Power Automate
Unanswered

Multiple values to look for in an IF Contains expression

(0) ShareShare
ReportReport
Posted on by 5

 

Hello,

 

I'm building a flow that gets the response from a form and adds it to an email, which content changes based on a selected value.

 

Instead of creating multiple scenarios using CONDITION/SWITCH, I created a string variable in which I'm adding all the scenarios as IF expressions with Contains to look at the selected value submitted with the form. The image shows what I'm describing, however I will likely have +30 scenarios, which explains why I don't want to rely on CONDITION/SWITCH.

 

sclement_0-1665682971069.png

 

My strings look like this:

 

if(and(contains(outputs('Get_response_details')?['body/XXXXX'],'COUNTRY1'),contains(outputs('Get_response_details')?['body/YYYYY'],'PRODUCT1')),body('CONTENT'),'')

 

So, if response from XXXXX contains COUNTRY1, and response from YYYYY contains PRODUCT1, then display CONTENT 

 

However, I would like that if response from XXXXX contains COUNTRY1 or COUNTRY3 or COUNTRY5, and response from YYYYY contains PRODUCT1, to display CONTENT

 

it's the OR part that I can't figure out.

 

I thank you in advance for your help!

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

    Hi @sclement 

     

    You just need to add the or function to the and function.

    if(and(or(contains(outputs('Get_response_details')?['body/XXXXXXX'],'COUNTRY1'),contains(outputs('Get_response_details')?['body/XXXXXXX'],'COUNTRY3'),contains(outputs('Get_response_details')?['body/XXXXXXX'],'COUNTRY5')),contains(outputs('Get_response_details')?['body/YYYYYY'],'PRODUCT1')),body('CONTENT'),'')

     

    Best Regards,

    Levi

  • sclement Profile Picture
    5 on at

    Wonderful, Levi! It worked like a charm!

     

    Thank you for your quick reply.

    Sacha

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

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard