cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BenDonahue
Skilled Sharer
Skilled Sharer

Using the Body of "Get response details," how to load an array with Responses from Forms Pro

Being provided this object from "Get response details:"

{
"responder": "BDonahue@healthcareswfl.org",
"submitDate": "10/2/2020 6:02:14 PM",
"raf03b7b3e8054666b737a20e30d25abf": "",
"r71b19e7c5beb4dba95fee5e9d9578bc2": "No",
"r4da533c8aeb3472aacd19c2f1250e75c": "",
"r53d3e3791038471f894029c5634d8e6d": "No",
"r2efc3356f5064729b0f186e7f6b5b52d": "No",
"rb7dbfe7ca0cc4b25a1cf659414fff419": "No",
"r014fe8a6004b46dbb1dbed880968ca79": "No",
"r20d0ef76e51e426f8911d0d7ce2e272e": "",
"rb906a66fb83c449ca1d0e35c427f3a02": "13",
"r24be9a1ba7f9468fae16b296331d4c25": "",
"r0184384dd0c44d88af36051a758ba5aa": "No",
"r8b337663cc03426c92704ccd813be3b8": "No",
"rdf04e95ac19042a5894ca0f7b35292d0": "",
"r23ebfc6e6b8d4729923867b8e6ebd548": "No",
"r7486d8f749194143a405d901c0099799": "",
"r48c1c4e8093743ed92d8e9fb9a9a2978": "s1 notes",
"r92b84414bcdd47e1a81bd7e3fa4245e4": "s2 notes",
"r745fad073e1745d0a0d5edf25e7d2fb0": "s3 notes"
}
I want to dynamically populate an HTML chart I am creating with "Append to string variable" via "Apply to each." The append field in that block would be something like:
currentItem.codeForTheQuestion</td><td>
 
I realize that accessing data in an object is 100 level stuff, but doing that from within Flow eludes me. 
I want to create an array the responses; how is that accomplished?
2 ACCEPTED SOLUTIONS

Accepted Solutions
Amapola188
Advocate II
Advocate II

Hi Ben

 

Not sure whether you ever figured this out. I just had to do the same thing so sharing my solution here. - Just in case anybody wondering, I'm setting up a recipe competition and I'm generating a PDF with the recipe so I'm pulling out an image file to put into the document.

 

The output from the File Upload looks like this:

[{"name":"CoconutEggs_anonymous.jpg","link":"https://xxxapc-my.sharepoint.com/personal/christine_xxx_com/Documents/Apps/Microsoft%20Forms/Recipe%...","id":"017DSYH4XSPA4QWUVXM5ELFTFLM3OHSUAG","type":null,"size":9084,"referenceId":"017DSYH4XK6R7UNOPMXFE2QBL45G54O5SS","driveId":"b!vng1mjYjoEenE3rf7Al-QVcDegThf3BAtyyC88UQcEKbbGzW3Va6R644pkSDL1cQ","status":1,"uploadSessionUrl":null}]

I've used this post as a guide how I need to pull the file content:

https://powerusers.microsoft.com/t5/Building-Flows/Working-with-files-from-the-Forms-quot-File-Uploa...

 

So I need to get to:

DriveID.ID

 

I've tried all sorts of extract from Jason combos but nothing worked. And if you do parse JSON, you only get down to the above string. Which means we need to extract the information from that string in a different way which I've done with an expression:

trim(first(split(last(split(outputs('Get_response_details')?['body/r6acd17e668b7406f91f12ba729ba3d44'],'driveId":"')),'","status')))

trim(first(split(last(split(outputs('Get_response_details')?['body/r6acd17e668b7406f91f12ba729ba3d44'],'id":"')),'","type')))

 

This worked for me.

Happy Automating!

Christine

View solution in original post

BenDonahue
Skilled Sharer
Skilled Sharer

This was two years ago, but, as I recall, I did use a Parse JSON, and that left the question codes accessible by simple method calls. The question codes listed in the question are (were) drawn from a Forms form.

View solution in original post

4 REPLIES 4
Amapola188
Advocate II
Advocate II

Hi Ben

 

Not sure whether you ever figured this out. I just had to do the same thing so sharing my solution here. - Just in case anybody wondering, I'm setting up a recipe competition and I'm generating a PDF with the recipe so I'm pulling out an image file to put into the document.

 

The output from the File Upload looks like this:

[{"name":"CoconutEggs_anonymous.jpg","link":"https://xxxapc-my.sharepoint.com/personal/christine_xxx_com/Documents/Apps/Microsoft%20Forms/Recipe%...","id":"017DSYH4XSPA4QWUVXM5ELFTFLM3OHSUAG","type":null,"size":9084,"referenceId":"017DSYH4XK6R7UNOPMXFE2QBL45G54O5SS","driveId":"b!vng1mjYjoEenE3rf7Al-QVcDegThf3BAtyyC88UQcEKbbGzW3Va6R644pkSDL1cQ","status":1,"uploadSessionUrl":null}]

I've used this post as a guide how I need to pull the file content:

https://powerusers.microsoft.com/t5/Building-Flows/Working-with-files-from-the-Forms-quot-File-Uploa...

 

So I need to get to:

DriveID.ID

 

I've tried all sorts of extract from Jason combos but nothing worked. And if you do parse JSON, you only get down to the above string. Which means we need to extract the information from that string in a different way which I've done with an expression:

trim(first(split(last(split(outputs('Get_response_details')?['body/r6acd17e668b7406f91f12ba729ba3d44'],'driveId":"')),'","status')))

trim(first(split(last(split(outputs('Get_response_details')?['body/r6acd17e668b7406f91f12ba729ba3d44'],'id":"')),'","type')))

 

This worked for me.

Happy Automating!

Christine

Wow! That solution is intense!! You say this grabbed data from a JSON and you didn't have to parse it first?

I'll have to go back and split our your methods there and see what is actually going on in there. 

 

Very cool, and, thank you for posting and helping!!!

 

(I promise, this group is not dead, in fact, we are tooling up and are about to get underway with gusto! Thank you for your patience....)

Amapola188
Advocate II
Advocate II

Hi Ben

 

No Parse JSON. Big fan of Tom Riha's work on this (and anything he does, such a great resource!).

I'm in New Zealand so I actually figure I don't need to be too careful with additional steps hitting my process limits because my datasets tend to be NZ-sized 😀. But I'm still more likely to add the expression into the input rather than put a Compose action and use its output.

 

My method for building these convoluted expressions is starting with step one and testing it (i.e. valid expression). Then wrapping it into the next layer. Repeat. - I have to admit that doing it that way also helps me understand what is going on in the expression, as you say.

 

Amapola188_0-1666720454161.png

 

And this is the condition with the variable if there's no image:

 

Amapola188_1-1666720617270.png

 

 

BenDonahue
Skilled Sharer
Skilled Sharer

This was two years ago, but, as I recall, I did use a Parse JSON, and that left the question codes accessible by simple method calls. The question codes listed in the question are (were) drawn from a Forms form.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (1,828)