cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
firstImage

New Ranks and Rank Icons in April

Read the announcement for more information!

firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (3,917)