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
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.
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.
@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
Tomac
986
Moderator
stampcoin
699
Super User 2025 Season 2
Riyaz_riz11
577
Super User 2025 Season 2