Nested IF Expressions within Flow

Copper Contributor

Hi.  I am trying to use nested IF expressions to populate a Word template with Flow.  Although the expression is accepted and the flow reports that it has run successfully, the template is not populated correctly.  An example is below (sorry it's huge...):


if(equals(body('Get_response_details')?['rb74aa75486494313bcbbd14debd63c5d'],'No'),'All staff have completed the mandatory eLearning modules within the last year for the destination in which they are based. ',if(equals(body('Get_response_details')?['r510000c87b1a4870aabd7d54cde00088'],'No'),'Have risk assessments been completed for any colleague who is pregnant, is a disabled person, is a wheelchair user, has learning difficulties, has cerebral palsy, has a mental health condition, is a person with a hearing impairment, is a person with a visual impairment, is a person with epilepsy, diabetes, who has depression, has restricted growth or short stature or who suffers from seizures?  These should be filed in the Risk Assessment Register (RAR) and retained for 3 years. ',if(equals(body('Get_response_details')?['r8875e99cb17a403c850d849c67d61ee9'],'No'),'All risk assessments are kept in the Risk Assessment Register and reviewed annually.  Each risk assessment should be kept for as long as it is applicable and for at least 3 years following its last application. ',if(equals(body('Get_response_details')?['r11b068e6afe54166a9437cca4fe2f146'],'No'),'Risk assessments have been completed for airport duties and filed in the RAR. ',if(equals(body('Get_response_details')?['re445b39a97c54983aa421bb7ebe2adfe'],'No'),'Display Screen Equipment (DSE) risk assessments have been completed for each office based member of staff.  These are filed in the RAR. ','No Serious Concerns Raised. ')))))


If all the responses are No when completing the Form, it will only populate the template with the first statement ("All staff have completed the mandatory eLearning modules within the last year for the destination in which they are based."), ignoring the remaining "nested" conditions.


Can anyone assist, please?


Many thanks.

4 Replies

Hi @Matt Bryant 


Hope you are well.


I'm having a squiz at your expression and the logic doesn't quite make sense to me (there may be things in your flow that you haven't shown or described here so I will make some assumptions).


If the first answer to the question is No then it will print "All staff have completed the mandatory eLearning modules within the last year for the destination in which they are based" and stop there and ignore the other conditions. 


The first part of the expression is only checking one question, so how will know that all four questions are answered to meet this condition?


The same applies if you make it to question two and the answer is No and so forth.


Are you looking to to check against all questions and execute the IF statements to vet each answer, or do you want to stop when a condition is met?


If you could please outline your logic, it would help figure out what's happening.




Hi again @Matt Bryant 


As an additional post to my earlier response and on an assumption, have you tried using Condition to break down your requirements in a user friendly way? 


If you needed to vet the combos (e.g. all No, 3 No and 1 Yes, 2 No and 2 Yes, etc) then using nested conditions gives you a GUI to set your conditions by and to then execute that particular result you are seeking.




Hope that helps in some way?




Hi @Damien_Rosario  - thanks for getting back so quickly.


For a bit of background, I am creating a compliance self-assessment for our various offices to complete.  The final page of the document that is produced lists any high-priority concerns from each section of the assessment.  Where none of these concerns are identified, I would like to say "No concerns identified" or similar, rather than just leaving the section blank.


The formula I have written is based on Excel, but it is clearly not quite right for Flow!



Hi @Matt Bryant


Blah so my entire post failed to upload so I'm doing this again.


I'm still not quite clear on your set up, are you using a single field in your doc to display the result from your IF statement, or are you looking to have each questions result in the doc?


Also in case you want further options and other opinions, you can try the experts at These guys are insanely amazing.


I'm happy to help explore what to do but I will need more info as it's tough to diagnose something without knowing what outputs you want in the last page of the doc.


Best wishes for the weekend ahead