cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Filter null values from a Forms Array

I am trying to use Flow to take an MS Forms response and send it in an email. I want the email to list the form question titles and answers, but only for questions that contain answers (exclude null Answers).

 

I have been trying putting the Forms Responses into an Array Variable and then using Filter Array, but i'm flailing around.

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Resident Rockstar
Resident Rockstar

Re: Filter null values from a Forms Array

Hi @brock , thank you for your post.

See below for a solution.

Note: This could be tidier using composes to store the form answers but you'll see this works for my example.

Here is the form:Capture-406.png

I have answered only 2 questions, Q1 & Q2 and I get these results in an email.Capture-407.png

Here is the Flow.Capture-409.png

if(equals(not(empty(body('Get_response_details')?['rd0991dbc9ca24915b9b7dfc0b1dbbc05'])), true), concat('Q4: ', body('Get_response_details')?['rd0991dbc9ca24915b9b7dfc0b1dbbc05']), null)
if(equals(not(empty(body('Get_response_details')?['r4b6e28cb8fa748dea068dc564271226e'])), true), concat('Q1: ', body('Get_response_details')?['r4b6e28cb8fa748dea068dc564271226e']), null)
if(equals(not(empty(body('Get_response_details')?['r1db7d847e9ff4072b9f10f7d71382ae2'])), true), concat('Q2: ', body('Get_response_details')?['r1db7d847e9ff4072b9f10f7d71382ae2']), null)
if(equals(not(empty(body('Get_response_details')?['read2ee4db44e4e00a59afdbfb4685940'])), true), concat('Q3: ', body('Get_response_details')?['read2ee4db44e4e00a59afdbfb4685940']), null)

Capture-410.png

 

Clearly, you will need to change each form answer to yours

If you look closely at each body('Get_response_details')?['GUID'] you can see what to change.

Even better, add each question to a compose to save the long GUID style value in you If statements.

 

If you replicate this, it will work based on my successful testing.

 

If you have found my post helpful, please mark thumbs up.

Any other questions, just ask.

Thanks, Alan


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


View solution in original post

4 REPLIES 4
Highlighted
Resident Rockstar
Resident Rockstar

Re: Filter null values from a Forms Array

Hi @brock , thank you for your post.

See below for a solution.

Note: This could be tidier using composes to store the form answers but you'll see this works for my example.

Here is the form:Capture-406.png

I have answered only 2 questions, Q1 & Q2 and I get these results in an email.Capture-407.png

Here is the Flow.Capture-409.png

if(equals(not(empty(body('Get_response_details')?['rd0991dbc9ca24915b9b7dfc0b1dbbc05'])), true), concat('Q4: ', body('Get_response_details')?['rd0991dbc9ca24915b9b7dfc0b1dbbc05']), null)
if(equals(not(empty(body('Get_response_details')?['r4b6e28cb8fa748dea068dc564271226e'])), true), concat('Q1: ', body('Get_response_details')?['r4b6e28cb8fa748dea068dc564271226e']), null)
if(equals(not(empty(body('Get_response_details')?['r1db7d847e9ff4072b9f10f7d71382ae2'])), true), concat('Q2: ', body('Get_response_details')?['r1db7d847e9ff4072b9f10f7d71382ae2']), null)
if(equals(not(empty(body('Get_response_details')?['read2ee4db44e4e00a59afdbfb4685940'])), true), concat('Q3: ', body('Get_response_details')?['read2ee4db44e4e00a59afdbfb4685940']), null)

Capture-410.png

 

Clearly, you will need to change each form answer to yours

If you look closely at each body('Get_response_details')?['GUID'] you can see what to change.

Even better, add each question to a compose to save the long GUID style value in you If statements.

 

If you replicate this, it will work based on my successful testing.

 

If you have found my post helpful, please mark thumbs up.

Any other questions, just ask.

Thanks, Alan


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


View solution in original post

Highlighted
Frequent Visitor

Re: Filter null values from a Forms Array

this is brilliant and absolutely puts me on my way! 

 

Another question though @AlanPs1 :

 

How can I pull the Question text with an expression?  I see you are pulling the Answer text from the Get Response body with an expression.  When I run a Flow test, the OUTPUTS of Get Response details has this info, but I don't know how to get at it.

 

🙂

Highlighted
Frequent Visitor

Re: Filter null values from a Forms Array

I asked my followup question in a seperate question as that might be helpful for people:  Pull MS Forms Question 

Highlighted
Frequent Visitor

Re: Filter null values from a Forms Array

Great solution! But what if branching changes the Question numbers dynamically?

 

Please suggest a solution as I am stuck.

 

Regards

Jagan

Helpful resources

Announcements
firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

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!

Top Kudoed Authors
Users online (12,436)