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 / Troubleshooting nested...
Power Automate
Answered

Troubleshooting nested or(if,if,if,if) expression

(0) ShareShare
ReportReport
Posted on by 87
I have the following or(if) expression:
 
or(
if(contains(outputs('Compose'), 'ANS'), 'e8...bd', ''),
if(contains(outputs('Compose'), 'SOL'), '9a...24', ''),
if(contains(outputs('Compose'), 'RD'), '4d...85', ''),
if(contains(outputs('Compose'), 'LD'), '60...14', ''),
if(contains(outputs('Compose'), 'Internt'), '99...fd', '')
)
 
Any of the single statments work without a problem, but if I wrap them in an or function with commas between, they fail with the following message: 

Unable to process template language expressions in action 'Post_studio_meeting' inputs at line '0' and column '0': 'The template language function 'or' expects all of its parameters to be booleans. Found invalid parameter types: 'String'.'.
 
I don't see any busted '' and the documentation on the Or function isn't helpful. Any advice?
 
 
Categories:
I have the same question (0)
  • Verified answer
    AndreasO Profile Picture
    87 on at
    Figured it out. Using OR was improper here since the IF conditions return values instead of true/false. Nesting the IF conditions instead worked. 
     
    if(contains(outputs('Compose'), 'ANS'), 'e8...bd', 
       if(contains(outputs('Compose'), 'SOL'), '9a...c24', 
          if(contains(outputs('Compose'), 'RD'), '4d...85', 
             if(contains(outputs('Compose'), 'LD'), '60...14', 
                if(contains(outputs('Compose'), 'Internt'), '99...fd', '')
             )
          )
       )
    )
     If anyone reading this is trying to figure out the logic here, look at the lack of a second , in the first IF statement. The syntax for an if statement is "if(logical test), result if true, result if false". In the above code, the next IF statement runs if the first logic test returns false. This can cascade indefinitely, but if you know one option is more likely than another, that should optimally be put first or early in the chain of If statements. 

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

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard