cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Kudo Collector
Kudo Collector

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
Highlighted
Community Support
Community Support

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
Highlighted
Community Support
Community Support

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

Highlighted
Anonymous
Not applicable

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
Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Top Solution Authors
Top Kudoed Authors
Users online (5,072)