
Announcements
Hello. I'm new to power Automate.
I have multiple conditions in a flow.
I can't use a switch because I need to compare against a range.
Can anyone help me with a better way to do this flow?
The rule is that I need to calculate how many days an employee can take to complete a training.
After this I use a Send Email V2 to inform the employee about the due date
If it is 35 to 40 hours it takes 7 days
If it is 25 to 35 hours it takes 6 days
If it is 20 to 25 hours it takes 5 days
If it is 10 to 20 hours it takes 4 days
If it is 0 to 5 hours it takes 2 days
Thank you very much
Hi @lauratn
You can use filter array. The flow is:
Where Number is the number of hours.
I've only put the first two items in the Compose. You'll need all your conditions.
Then, you need to filter the array.
Outputs is outputs('Compose')
You need advanced mode to enter the expression:
@and(greaterOrEquals(triggerBody()['number'],item()?['min']),less(triggerBody()['number'],item()?['max']))
Note; I've used less rather than lessOrEqual to ensure there is only one match for bounds 10-20 and 20-25 for example.
Finally