I am trying to add a condition to a Flow that will decide yes or no according to words in the file name. My condition looks like this but keeps failing
How do I fix this and what do I do if I want to look for more than one word in the file name?
Can you explain what you mean by failing? Do you see an error or does it not work as expected?
Could you please share a full screenshot of the configuration of your flow?
I have made a test on my side and don't have the issue that you mentioned.
But this design can not check whether the filename contains the specified value, because "triggerOutputs()['headers']['x-ms-file-name-encoded']" outputs some special encoding values, not the name of the file display.
You could use Get File metadata to get the Display Name of the file to judge. Then use Expression to check if one or more specified values are included.
@and(contains(body('Get_file_metadata')?['DisplayName'], 'Acme'), contains(body('Get_file_metadata')?['DisplayName'], 'Test'))
It worked, as below:
Please take a try and let me know if issue still exist.
I have one more question. What would be the best way of addressing a list of values. Let's say I want to check for 10 different words in the file name and act accordingly. How would this be best addressed?
Do you mean that if you want to check a lot of words, the expression will be complicated?
I need to know that you want to check that the file name contains only one word, the condition is met, or all words are included.
If it is Or, you could try the following workaround:
Create a new table, enter the word you want to check. Because it is an Or relationship, execute the next step as long as one meets the condition. There is no action in If No.
Please take a try.
I have tried this and get the following error:
InvalidTemplate. Unable to process template language expressions for action 'Condition' at line '1' and column '2432': 'The template language function 'contains' expects parameters of matching types: a dictionary and a key (string), an array and a value (object), or a string and a substring. The provided types 'String' and 'Array' are incompatible. Please see https://aka.ms/logicexpressions#contains for usage details.'.
Did I do something wrong on the get row action? Seems like no data was extacted from the get rows action
Could you provide your flow run details?
Especially the output of the Get Rows action.
I would be helpful if you posted a screen shot of the Flow as well.
Thank you for posting on the Flow Community Forum! It appears as though @v-bacao-msft would like some more information in order to further assist you properly with your issue. Please share any additional information that was requested in order to decrease the amount of time that it will take for you to be assisted!
Thank you for being an active member of the Flow Community!
Flow Community Manager
Please make sure that the condition is filled in the Excel Table column. It seems that you are filling in the value, and the value output is an array, so there will be an error that the type does not match.
Please take a try.
I finally got this working - instead of contains Value I used conatains Table1 and it fired off right away.
But now I have another issue. It runs the flow once per row in the table. I want it to run once per file. If it runs once per row row 1 will be true but the rest will be false becuase there will only be one row match per file. Its practically stating all the vales need to be true rather than process as true if one of the values is true. I want it to prcess per file rather than per row in the table.
Features releasing from October 2020 through March 2021
We are excited to announce the launch of Power Virtual Agents Community. Check it out now!
We've updated and improved the layout and uploading format of the Power Automate Cookbook!
Fill out a quick form to claim your user group badge now!