cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
solisruj
Level: Powered On

Advanced Syntax Condition: OR and Contains

Hi there, 

 

I want to say thanks in advance for helping out. I am currently working on figuring it out, and if I do I will close this as and provide my solution. 🙂 

 

I looked over a few different advanced syntax condition questions posted on the Microsoft Community Boards; Building Flows. The syntax for @or() and @contains() seemed pretty simple. So, I tried to write out an advanced syntaxt condition that does the following: 

 

1. If file_name contains '-IS-', or '-PU-', or '-TO-' I want you to: 

    2. Perform etc...

 

Here is my syntax for 1.: 

 

@or(@contains(body('Get_file_properties')?['{FilenameWithExtension}'], '-IS-'), @contains(body('Get_file_properties')?['{FilenameWithExtension}'], '-PU-'), @contains(body('Get_file_properties')?['{FilenameWithExtension}'], '-TO-'))

 

 However, I get the following error:  

 

The power flow's logic app flow template was invalid. The property 'expression' 'encodeURIComponent(concat(@or(@contains(body('Get_file_properties')?['{FilenameWithExtension}'], '-IS-'), @contains(body('Get_file_properties')?['{FilenameWithExtension}'], '-PU-'), @contains(body('Get_file_properties')?['{FilenameWithExtension}'], '-TO-'))))' of template action 'Condition_6' at line '1' and column '3868' is not a valid template language expression.

 

I have also tried it without encodeURIComponent(concat()) and get a similar error. 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Advanced Syntax Condition: OR and Contains

Hi @solisruj,

 

Please take a try with expression below:

@or(or(contains(body('Get_file_properties')?['{FilenameWithExtension}'], '-IS-'),contains(body('Get_file_properties')?['{FilenameWithExtension}'], '-PU-')),contains(body('Get_file_properties')?['{FilenameWithExtension}'], '-TO-'))

 

Please let me know if your problem could be solved.

 

Best regards,

Alice

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: Advanced Syntax Condition: OR and Contains

Hi @solisruj,

 

Please take a try with expression below:

@or(or(contains(body('Get_file_properties')?['{FilenameWithExtension}'], '-IS-'),contains(body('Get_file_properties')?['{FilenameWithExtension}'], '-PU-')),contains(body('Get_file_properties')?['{FilenameWithExtension}'], '-TO-'))

 

Please let me know if your problem could be solved.

 

Best regards,

Alice

View solution in original post

solisruj
Level: Powered On

Re: Advanced Syntax Condition: OR and Contains

Thanks @v-yuazh-msft, I did not realize that  @or() function only takes in two arguments. I also did not realize that the outside expression is the only one that requires the @ symbol.  🙂

 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 333 members 5,252 guests
Please welcome our newest community members: