cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
dgpadia
Level: Powered On

For each loop on Forms answers

In my form, I want the responder to be able to add multiple urls to one answer separated by commas. In flow, I want to be able to display those links in a Teams message (which I have set up and working properly). The only way I've seen to display links from a Forms response is to wrap it in HTML:

<a href="[form response]">[form response]</a>

I want to be able to display it in the teams message as 

Links: [link1] [link2] [link3] [link4]... etc.

I'm new to flow and my Google searches... I mean Bing searches... haven't turned up what I'm looking for. Chalk it up to not knowing what things are called, most likely. I've looked through expressions pages in Microsoft docs and understand that you can run loops, but I'm not seeing how to run a loop within a message body like that, only running loops over the items that are generated via actions and triggers. 2019-01-14 12_05_44-Edit your flow _ Microsoft Flow.png

 

 

I know I can split the string by whatever delimiter I tell them to, but can I then loop through the items of the resulting array and tell it to display " <a href="[item()]">[item()]</a>" for each item? The responder will be instructed to submit links separated by commas. link1, link2, link3, etc. Above is basically my full flow (minus the response submitted trigger), so I'm happy to redo any of it to get it to work the way I want. 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: For each loop on Forms answers

Hi @dgpadia,

 

I am not sure if you want to include these four links in a Teams message, or send four messages to contain these four links. Could you provide a specific example?

I guess you don't know how to reference the separated elements of the Split() function.

The Split() function splits the specified String into an array, so you could call the element just by using "Split(‘String')[index]".

If you want to automatically display the number of links based on the number of URLs populated by the user, you could configure your Flow as follows:

1. Initialize two variables, one is String, the message is stored, and the other is Integer, which is used to store the index of the link.

17.PNG

2. Use the Split() function to split the URLs based on the comma to generate an array.

split(body('Get_response_details')?['r4edc960694854603b66f7b0a90c35571'],',')

    The first parameter in the expression needs to be populated according to the actual situation of your Forms.

18.PNG

3. Traverse the array, in the format of the hyperlink, configure the array elements in the corresponding places, each time you traverse, the index needs to add one.

    Note that Current item is the Dynamic content output by Apply_to_each_2.

    And if you want the final result to show a space between the links, you need to type the space bar in the Value of the Append to string variable.

4. Finally, configure the String variable in the Message.

19.PNG

Image reference:

20.PNG21.PNG

Please take a try.

 

Best Regards,

Barry

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

Re: For each loop on Forms answers

Hi @dgpadia,

 

I am not sure if you want to include these four links in a Teams message, or send four messages to contain these four links. Could you provide a specific example?

I guess you don't know how to reference the separated elements of the Split() function.

The Split() function splits the specified String into an array, so you could call the element just by using "Split(‘String')[index]".

If you want to automatically display the number of links based on the number of URLs populated by the user, you could configure your Flow as follows:

1. Initialize two variables, one is String, the message is stored, and the other is Integer, which is used to store the index of the link.

17.PNG

2. Use the Split() function to split the URLs based on the comma to generate an array.

split(body('Get_response_details')?['r4edc960694854603b66f7b0a90c35571'],',')

    The first parameter in the expression needs to be populated according to the actual situation of your Forms.

18.PNG

3. Traverse the array, in the format of the hyperlink, configure the array elements in the corresponding places, each time you traverse, the index needs to add one.

    Note that Current item is the Dynamic content output by Apply_to_each_2.

    And if you want the final result to show a space between the links, you need to type the space bar in the Value of the Append to string variable.

4. Finally, configure the String variable in the Message.

19.PNG

Image reference:

20.PNG21.PNG

Please take a try.

 

Best Regards,

Barry

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
dgpadia
Level: Powered On

Re: For each loop on Forms answers

This was my first real project with Flow, and you have helped me to understand so much more about how to use it. I understand a lot of the basic concepts of programming (I'm in school for network admin, so we learn coding concepts in C#, but I'm not a programmer), I just didn't know how to set it up in Flow/Azure Logic Apps. Thank you!!

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 192 members 5,522 guests
Please welcome our newest community members: