Skip to main content
Community site session details

Community site session details

Session Id : iJNkZU0EnlEVXOeAyNUF1c
Power Automate - Using Flows
Unanswered

Summarising form responses using multiple if statements

Like (0) ShareShare
ReportReport
Posted on 12 Sep 2021 10:30:55 by 2

I have responses from a form that has many yes/no questions. I am using a flow to send an email with the summary of the results (only the true findings). I have a solution, but its not very elegant. Essentially I am creating a new expression for every question (snippet below which I use to create 4 seperate functions).

 

if(equals(body('Get_response_details')?['r2409c1dc73b04aeabde6ffebeb98e62b'],'Yes'),'Coagulopathy<br/>',''),

if(equals(body('Get_response_details')?['r1b5abdf8c9be4ba6a15aa12801b639a4'],'Yes'),'COPD<br/>',''),

if(equals(body('Get_response_details')?['rdd58cadf0cf1478ca32c52fe17b8ba3c'],'Yes'),'Depression<br/>',''))

if(equals(body('Get_response_details')?['r3d673dc8985f4a19b89d6a5d2393a695'],'Yes'),'Diabetes<br/>','')

 

Any suggestions on how make this better?

 - can i nest multiple if statements in one expression

 - the reference (ie r2409c....) is also the response I want if true. Instead of typing "coagulopathy" as a string, can I call the question (reference) and output it as a string, with a line break after it?

 

Hope that makes sense.

 

Thanks

  • VJR Profile Picture
    7,635 on 16 Sep 2021 at 11:42:26
    Re: Summarising form responses using multiple if statements

    Hi @maunder1991 

     

    In the 'Templates' section you could open and check out some of the Templates related to processing of Forms responses.

    You could get direct hints on storing the responses.

     

    Below are some of them - 
    - Notify me and store the response when a student completes a quiz
    - Track Microsoft Forms response in Excel and notify through Teams and email



    -------------------------------------------
    Help fellow beings find relevant posts.
    Upvote to a supporting response.
    Mark as solution to an answer.

     

     

  • maunder1991 Profile Picture
    2 on 15 Sep 2021 at 12:34:22
    Re: Summarising form responses using multiple if statements

    Hi Anna,

    Firstly thank you for your response, its not exactly what I'm after though.

     

    I dont want a nested if that follows an algorithm to a single solution - I want multiple outputs. Please consider the following pseudocode to demonstrate what I want to achieve:

     

    If a=1 print "true"

    If b=1 print "true"

    If c=1 print "yes"

     

    Output would then be: true true yes. Rather than if the statements were nested it would just give a single output.

     

    In regards to your second suggestion. "Coagulopathy" is the question on the form, not the response.

     

    I'll include the actual example I'm trying to achieve. See the screenshot of the form. I want to create a flow that provides an output (email) of only the positive medical conditions the patient has. Currently its 17 different functions. I'll also include the function i'm currently using for each condition. Any suggestions on how to make this better are appreciated.

     

    if(equals(body('Get_response_details')?['r2409c1dc73b04aeabde6ffebeb98e62b'],'Yes'),'Coagulopathy<br/>','')
     
    Screen Shot 2021-09-15 at 10.31.45 pm.pngScreen Shot 2021-09-15 at 10.31.40 pm.png
  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on 15 Sep 2021 at 09:00:55
    Re: Summarising form responses using multiple if statements

    @maunder1991  yes you can nest multiple if statements in one expression. Regarding the second question about "coagulopathy", do you have it in form response? you can check the trigger outputs in flow run, if it is there, then you can use it via dynamic content.

    Reference post for nested if: https://powerusers.microsoft.com/t5/Building-Flows/Multiple-IF-statements-in-Approval-Flow/td-p/598540

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2

Featured topics

Restore a deleted flow
Loading started
Loading complete