cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
stgiesbrecht
Level 8

Creating and working with arrays

I am trying to take the output from a Form response and create an array or object that I can then loop through and do a find and replace so that I can update an HTML template file with the answers that someone submitted.

If I view the output from a compose on the form get response details I see

{
  "responder": "joe@abc.com",
  "submitDate": "10/15/2019 3:25:48 PM",
  "rd150a2c9a12f42c683dcfabec7f32a52": "Jim",
  "r6d253b9398c14d4f853d8c0df68d0857": "Bob",
  "r9c2da6f89bf74338b7395d49a99fe5ac": "jbob@gmail.com",
  "r99e5c06a5a1e4d179907101b6aaf53cd": "Calgary",
  "r717f9de19e0f44ab8a3fe7a3bb6b8e20": "",
  "rd8629ebb96a0487cb1e703adc805f048": "ABC Corp"
}
 
I can then do a Select to map the fields that I want to the find text like this
[
  {
    "{FirstName}": "Jim",
    "{LastName}": "Bob",
    "{Email}": "jbob@gmail.com",
  }
]
 
I would like to convert this to something that I can then use an "Apply to each" and take and loop through
each element and replace the string in the "{}" with the second string after the ":" in my HTML string
 
If I take an initialized hardcoded object variable of this and pass it to the "Apply to each" I can get
it to work. Is there a way to convert my Select above to get something similar to below
{
  "fields": [
    {"Name": "{FirstName}",
      "Value": "Jim"},
    {"Name": "{LastName}",
      "Value": "Bob"},
    {"Name": "{Email}",
      "Value": "jbob@gmailcom"}
  ]
}
 
Any suggestions would be greatly appreciated.
1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Creating and working with arrays

Hi @stgiesbrecht ,

 

I have made a test and couldn't find any way to achieve the requirement, I'm afraid that there is no any way to achieve it in microsoft flow currentl.

 

Best regards,

Alice       

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

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: Creating and working with arrays

Hi @stgiesbrecht ,

 

I have made a test and couldn't find any way to achieve the requirement, I'm afraid that there is no any way to achieve it in microsoft flow currentl.

 

Best regards,

Alice       

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

View solution in original post

spg-john-liu
Level 8

Re: Creating and working with arrays

 

Hey, depends on how good is your XPath 🙂

http://johnliu.net/blog/2017/11/foreach-property-in-microsoftflow-json-with-xpath-microblog

 

Bonus tip 1.  XML really doesn't like funny preceeding characters, so if you can control your initial mapping to avoid starting a property with numbers, you'll have a much better time.

 

Bonus tip 2.  If you want to dynamically read the Forms questions, you will need Flow dark arts.
https://www.youtube.com/watch?v=XwJto7zvfyk&feature=youtu.be

Good luck!

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Speakers, submit your sessions now! Call for speakers ends Feb. 10!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

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 Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,490)