Nest IF Instructions
You can nest an IF instruction inside another IF instruction. HotDocs won’t process the nested instruction unless the first (or top) level of the instruction is true.
In this example, if HotDocs finds that Client’s Marital Status was answered Married, HotDocs inserts the text with the spouse’s name and then checks to see if Client Has Children by This Marriage was answered true. If it is, HotDocs inserts the names of the children.
This ruling affects the client, «Full Name of Client»«IF Client's Marital Status = "Married"»; and spouse, «Full Name of Spouse»«IF Client Has Children by This Marriage»; and the following children: «REPEAT Children:a, b, and c»«Full Name of Child»«END REPEAT»«END IF»«END IF».
But if HotDocs finds that Client’s Marital Status was not answered Married, HotDocs skips the rest of the instruction, including the question about children in the marriage.
If you ask variables later in the template based on a nested IF instruction being true, you must make sure you use the full conditional reference before asking the variable. See Tips on Using IF Instructions.
You can have HotDocs identify the level of nesting in your IF instructions using both labels and field coloring. See Use Labels to Identify Instructions and Assign Colors to Fields and Instructions in Templates.