0
votes

I am creating a Flow and you can add a condition to check for. The condition by default has a simple "Value 1 equals/contains/... Value2" expression. To do more advanced conditions, you can use the Workflow Definition Language for Azure Logic Apps.

My question is: How can a check if a parameter matches more than 2 values. For example, I want to check if value1 equals value 2, value3, value 4, value5.

I know how to check for if value1 equals value2 or value 3. Let's say value2 is 2 and value3 is 3:

@or(equals(body('action1')?['value1'], 2),equals(body('action1')?['value1'], 3))

However, I am unsure to check for more values. The or() function only allows for 2 parameters. This is specifically for Microsoft Flow.

I tried using the intersection() function with the idea that if the value was found it would return a value and I could use empty() to return a boolean for the flow condition:

@not(empty(intersection([body('action1')['value1']], [39, 40,41, 42])))

When I try this, I get an error in flow;

The template validation failed: 'The template action 'my_condition' at line '1' and column '4124' is not valid: "Unable to parse template language expression 'not(empty(intersection([body('action1')['value1']], [39, 40,41, 42])))': expected token 'Identifier' and actual 'LeftSquareBracket'.".'.

Anybody have any ideas?

Reference: https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language

1

1 Answers

0
votes

I just encountered the same issue with needing to update a Microsoft Flow to do a 3 condition OR statement. I found that you could nest logical conditions to achieve the desired effect. See the following syntax below which worked for me.

@or(equals(triggerBody()?['Editor']?['DisplayName'], 'User 1', or(equals(triggerBody()?['Editor']?['DisplayName'], 'User 2'), equals(triggerBody()?['Editor']?['DisplayName'], 'User 3')))