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

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
Super User
Super User

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!


3 REPLIES 3
Super User
Super User

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!


brock
Level: Powered On

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.

 

Smiley Happy

brock
Level: Powered On

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 

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: 49 members 4,323 guests
Please welcome our newest community members: