While <<*Ask*>> commands will constitute the bulk of the Interview, it is the <<*If*>> command that forms the backbone of document logic process. You will need the <<*If*>> command to declare comparisons and to set up your decision and branching points.

 Let's say you are drafting a document that has optional text dealing with children. You want the text to be kept in the document when there are children and discarded when there are none. Let's further say that the document contains other language that you want to keep when there are minor children, but which should be discarded where there are none.

   Using <<*AskOptional*>> commands, you might ask the question "Are there children?". If (but only if) that question is answered "Yes", you might then ask "Are there minor children?". (Of course, if there were no children, there couldn't be  any minor children; therefore the question should not be asked..)

   Here is the way this sequence might appear:

<<*AskOptional*!Children!Are there children?*>>

<<*If*!Children!="Yes",<<*AskOptional*!Minors!Are there minor children*>>,!minors!="False">>

informationNOTE: The values "Yes", "True" and "1" are functional equivalents. The above could have been written:

<<*AskOptional*!Children!Are there children?*>>

<<*If*!Children!="True",<<*AskOptional*!Minors!Are there minor children*>>,!minors!="False">>

 

   Let's study the structure.

   1. Note first that a !groupname! (in this case !children!) is used. As with other !group!, the name ties the various elements of the document together.  

   2. Now note the classic three-part "if . . . then" programming structure in line 2:

"If Condition, (If 'True' Action), (If 'False' Action)"

   This three-part logic structure is practically universal. Simple commas are used to separate the three elements.

   As applied to the example, the user first encounters the initial (Children) question. The user provides either a "True" or "False" (or 'Yes' or 'No') answer. The "If" command is encountered immediately after. Pathagoras 'measures' the value of the !Children! group, and responds accordingly. If !Children! was answered "Yes" (by checking the check-box), Pathagoras presents the prompt that appears between the first comma and the second comma. If Pathagoras sees that !Children! was not answered "Yes", it processes the information that follows the second comma. This 'logic' follows classic 'Boolean' logic, which 'reads': If (this) is true, then (do this), else (do this).

It is perfectly acceptable (sometimes) to leave the 'False' portion of the 'If' statement blank:

 

<<*If*!Children!="Yes",<<*AskOptional*!Minors!Are there minor children*>>,>>

 

   See Bigger Example for more examples of the <<*If*>> command.

   Setting a True/False Value

 

Setting a 'True/False' value (<<*Optional* . . .>>):

<<*Optional* commands are processed based on simple 'true' and 'false' values of a !group!. And the group can be set via an <<*If* statement, and several examples above demonstatrat that. Here is a repeat of one:

 <<*If*!Children!="Yes",<<*AskOptional*!Minors!Are there minor children*>>,!minors!="False">>

   

 

  Repeats: If you need to assign a Repeat value of one GroupName to that of another, you can make that assignment with the !Group1!=!Group2! command. E.g.,

 <<*AskOptions*!OurClient!Plaintiff/Defendant*>>

 <<*AskRepeat*!Plaintiffs!>>

 <<*AskRepeats*!Defendants!>>

 <<*If*!OurClient!="1",!Clients!=!Plaintiffs!,!Clients!=!Defendants!>>

 Depending upon the various assignments, if your client is the defendant, the number of repetitions of [Client Name] in the document will be equal to the number of Defendants selected at the top.

   

Debugging 'If's

   When your 'If' statements seem not to give the expected results, check these elements:

 The sequence of the 'True' and 'False' portions

 The sequence of a precedent Ask commands that sets the value of the 'If' comparator.

 The proper spelling of the !GroupNames!.

 Is the 'False' value of the statement set? See above for discussion.

NOTES:

1.  The <<*If command, and it's various parts (the 'True' part and the 'False' part and its mandatory structural elements)  is definitely 'programming language. Therefore, If's will be use only within the Ask table portion of a document where programming is allowed.

2.   If an Ask table contains an '<<*If*. . .>> logic point for which the <<*If*>>'s !groupname! has no value (because, most likely it was asked in an immediately preceding <<*Ask*>> and therefore has not been set), Pathagoras will not proceed further until the precedent value is assigned. You can also break processing until the !Groupname! is set using the <<*Break*>> command.

3. When a number represents a position in a list, it is enclosed in quotes. When the number represents an actual value (i.e., 5 means 5 pets in the above examples), it is not enclosed in quotes.

4. You can set multiple values with the <<*If*>> command. Simply separate each item with the pipe ('|') character. E.g.

   <<*If*!Type of Deed!="2",!QuitClaim!="True"|!Warranty!="False",!QuitClaim="False"|!Warranty!="True">>

(The comma (in red) still separates the 'if true' and 'if false' parts of the master equation. The pipe tells Pathagaoras to split the true and the false parts into multiple actions.

5. You can set multiple groupnames to the same value within the <<*If*>> command. List them within the same ! and ! boundaries. E.g.,

    <<*If*!Type of Deed!="3",!Warranty!="True"|!Quit Claim,Special Warranty,No Warranty!="False",>>

5. The '<<*If command can accept the following arguments:

   (any)--<<*If*(any)!*Type Of Deed!="1,3,4,6",!Title Search Done!="True",!Title Search Done!="False>>

   (all)-- <<*If*(all)*!Selection!="3,4,6,9,10",!Vegan!="True",!Vegan!="False">>

           (not)--<<If*(not)*!States!="1,7",!Continental Tour Only!="True",!Continental Tour Only!="False">>

   See next page for more examples.

<<*If logic can be tough stuff. If you are nesting equations, adding multiple comparators and augmenting the equations with arguments and lists of possibilities, it will take you some time to get it all right. Don't get frustrated. Keep on trying. When testing, don't test on the entire document. Break out the relevant sections and put them in a new document for testing. When its working as expected, then move it back into your main document for 'full' testing.