While <<*Ask*>> commands will constitute the bulk of the document logic table, it is the <<*IF*>> command that forms the backbone of document logic process. You will need the <<*IF*>> command to declare your 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 follows the first comma. If Pathagoras sees that !Children! was not answered "Yes", it processes the information that follows the second comma.

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

 

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

  informationA logic lesson: The opposite of 'True' is not 'False'.The opposite of True is simply Not True. So, let's further discuss the above statement. The above statement is incomplete if you need to set !Minors! to "No" (or "False") when of !Children! is 'No' and you also intend to use a statement such as <<*If*!Minors!="False",(action)>>. The 'False' value of !Minors! cannot be assumed. It must be set by an equation, or you must affirmatively set it if you ever need to test it. The below 'If' statement is correct:

 

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

 

 

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

 

   A bit of Math:

   Pathagoras can do a bit of math for you if you desire. When a !GroupValue! has been set to a numerical amount, either through an <<*AskRepeat*>> or a <<*Set*>> function, you can perform a math function on the values. If the value matches the comparison set up, then the 'True' part of the <<*If*>> is processed, otherwise, the 'False' part is.

<<*If*!NumCdn!+!NumPets!>5,!CrazyHouse!=”True”,!CrazyHouse!=”False”)>>

 

  Multiple Comparators

   Math (above) lets you add values assigned to !groups!. But what if you just want to ask "If This AND This are true (or If This OR This are true), then do this.

   That is possible. Just use the 'AND' or the 'OR' connector:

 

<<*If*!NumCdn!>2 AND !NumPets!>2,!CrazyHouse!=”True”,!CrazyHouse!=”False”)>>

<<*If*!NumCdn!>4 OR !NumPets!>4,!CrazyHouse!=”True”,!CrazyHouse!=”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 our 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 is one of the 'Ask' commands (just without the 'Ask' prefacing it). We could have used 'AskIf' as the key word, but decided to use just the two letter 'If.'

2.  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.

3.  Pathagoras does not use programming language (e.g., 'If') in the body of any of 'Pathagorized' document.  If the block of text within your document is 'optional', it must be part of an <<*Optional* . . . >> text block. Do not try to program within the document by creating an <<*AskOptional* . . .>> command at the top of the document, and then measuring the answer with an <<*If* . . .>> block in the body.

4.  Use only <<*Options*. . .>> and <<*Optional* . . .>> blocks in the document body. They can all stand alone. If you need to tie the various blocks together (so that a selection of one results in the selection of a related other, use a !groupname!. It is groupnames that are a functional equivalent of 'If' without the necessity of programming a Boolean formula. (It is the groupname in the <<*If* . . . >> command that allows it to control the result of <<*Options* . . .>> and <<*Optional* . . . >> blocks further down in the document.

 

Created with Help & Manual 7 and styled with Premium Pack Version 2.70 © by EC Software