cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ToniRantanen
Advocate IV
Advocate IV

Flow with multiple "starts with" conditions

Hi!

 

I would like to create a Flow which has multiple (5) conditions. I am building a Flow which should launch in case value starts with either of these: "A", "B", "C", "D" or "E". Do you know if it is possible to have many values in "starts with" condition?

 

Best regards,

 

Toni

1 ACCEPTED SOLUTION

Accepted Solutions

Hi,

 

I managed to solve this. The correct syntax is:

 

@Or(startsWith(body('Get_response_details')?['r2133f7b97ab64d70bf5df04af1d0453e'], 'A'),startsWith(body('Get_response_details')?['r2133f7b97ab64d70bf5df04af1d0453e'], 'B'),startsWith(body('Get_response_details')?['r2133f7b97ab64d70bf5df04af1d0453e'], 'C'),startsWith(body('Get_response_details')?['r2133f7b97ab64d70bf5df04af1d0453e'], 'D'),startsWith(body('Get_response_details')?['r2133f7b97ab64d70bf5df04af1d0453e'], 'E'))

This will read information from Forms field and and accepts either A, B, C, D or E as a correct starts with answer. If word starts with any other letter, then the condition is false.

View solution in original post

4 REPLIES 4
v-yamao-msft
Community Support
Community Support

Hi @ToniRantanen,

 

Yes, it is possible to have many values within a condition. For your scenario, you could configure the code likes below:

 

@Or(startswith(triggerBody()?['Subject'], 'A'),startswith(triggerBody()?['Subject'],'B'),Startswith(triggerBody()?['Subject'],'C'))

 

I have made a test with it, please try with it on your side and feel free reply if you need more help.

 

For more details about the functions, please see it at here:

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#s... 

 

 

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yamao-msft,

 

and thanks for your reply!

 

I tested the solution you suggested but unfortunately it gives me an error message:

 

Screenshot.JPG

 

Am I doing something wrong?

 

Best regards,

Toni Rantanen 

 

Hi @v-yamao-msft,

 

Do you have chance to look at this? I am still having this issue.

 

The value I get, comes from Microsoft Forms form field. With one letter this works just fine, for example: 

@startsWith(body('Get_response_details')?['r2133f7b97ab64d70bf5df04af1d0453e'], 'A')

But I would need to get this work with multiple letters and I don't know the correct syntax.

 

I have tried to modify the example you gave:

@Or(startswith(triggerBody()?['Subject'], 'A'),startswith(triggerBody()?['Subject'],'B'),Startswith(triggerBody()?['Subject'],'C'))

to different formats but so far I haven't figured out the correct format. Would you be able to help?

Hi,

 

I managed to solve this. The correct syntax is:

 

@Or(startsWith(body('Get_response_details')?['r2133f7b97ab64d70bf5df04af1d0453e'], 'A'),startsWith(body('Get_response_details')?['r2133f7b97ab64d70bf5df04af1d0453e'], 'B'),startsWith(body('Get_response_details')?['r2133f7b97ab64d70bf5df04af1d0453e'], 'C'),startsWith(body('Get_response_details')?['r2133f7b97ab64d70bf5df04af1d0453e'], 'D'),startsWith(body('Get_response_details')?['r2133f7b97ab64d70bf5df04af1d0453e'], 'E'))

This will read information from Forms field and and accepts either A, B, C, D or E as a correct starts with answer. If word starts with any other letter, then the condition is false.

Helpful resources

Announcements
Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,337)