﻿ 'If/Then . . .' Structure
Pathagoras Help System

'If . . . /Then . . .' logic: Introduction

 'If . . . /Then . . .' logic: Introduction 'If . . . /Then . . .' logic: Introduction

Pathagoras is readily adaptable to the use what is called 'If/Then logic'. But before exploring that in detail, we first gather on this page the various approaches that do not involve formal "If/Then" setups. On subsequent pages, we will explore setting up specific If . . . / Then . . . formulae.

Simple Logic: Multiple Choice Variables with !Groups!

Before explaining this, let's make sure that you know how to construct a multiple choice variable. A multiple choice variable is a series of choices separated by slashes. Here are a few examples:

Actors: [son/daughter/children]

Related Pronouns: [he/she/they]  [his/her/their] [his/hers/theirs] [him/her/them]

The use of !GroupNames! is a true application of document logic. What you are saying is "If I select this particular value in this particular variable, then select the related value in other variables bearing the same groupname.

When you attach a !GroupName! to a related group of multiple-choice variables, all elements of the group will change in tandem. So instead of making the end-user choose individual answers to individual sets of related multiple choice questions, just !group! them. Then, when the user selects one of the !group! then, Pathagoras applies the 'selection' to the other member of the group.

My [!child!son/daughter/children] went with [!child!his/her/their] dog to the pet store because [!child!he/she/they] wanted to buy [!dog!him/her/it] a new collar. [!Child!He/She/They] decided to buy a fancy collar and a shiny new leash as well.

When the above text is processed using the Instant Database screen, the various variables will appear as multiple choices in a drop down list. When you select a value for any one member of the group, the appropriate value for the remaining members of the group will be automatically selected and presented. See this page for more discussion and illustrated examples.

When the document is processed and the user resolves the first member of any !group!, Pathagoras takes over and resolves the remainder.

Note: the resolution of a !GroupName! is based on the position (1st 2nd, 3rd, etc.) of the initial choice made. Make sure the number and order of the choices are in sync.

"Options" and "Optional" Text with !GroupsNames!

Similar to the way that !GroupsNames! can be applied to variables, you can use groups with Options text. This is explained in greater detail elsewhere, but here are a couple of examples which you can copy and paste into a document which will illustrate Pathagoras plain text 'if/then' concepts:

Thank you for selecting us as your interior design team. We suggest that the color for the living room be <<*Options*!colors!*red/yellow/burnt orange>> and the contrasting trim color be <<*Options*!colors!*sea green/purple/royal blue>>.

In the above example, if 'yellow' is selected for the answer to the first encountered <<*option*>>, then purple will be automatically selected when Pathagoras processes the second block. (Remember, the selection is positional. Yellow and Purple are in the second positions of their respective <<*Options*>> blocks.

Using "<<*Options*>>" text blocks to pull external text into present document.

The examples above contain the actual 'results' text as an integral part of the <<*Options*>> text block. But you are not limited to just internal text. Pathagoras lets you provide as one or more of your "options" references to external documents or glossary terms. So instead of having to type in each piece of your target text, just type in its reference.

Here is an example where text from a particular document will be returned to the screen. (The assumption here, of course is that 'cntr105', 'cntr155', 'cntr197', etc., actually exist. The example is intended to convey that enclosing a reference to a term or document within "<<" and ">>" will cause Pathagoras to seek it out and insert it when called for.)

<<*Options*Are the facts A?/Are the facts B?/Are the facts C?/Are the facts D?/Are the facts E?* <<cntr105>> /<<cntr155>> /<<cntr197>> /<<cntr200>> /<<cntr205>>>>

See Calls to Other Documents for more examples.

Pathagoras uses 'top-to-bottom' processing of [Variables] and of <<*Options/Optional*>> text blocks. Therefore, if you use !groups!, the first choice encountered controls the automatic selection of the remaining members of the group.

You can 'manually' type in the multiple choice variables or use Multichoice *Lists* to provide the listing of options for any of the examples above.

Instead of presenting 'static' choices as shown in the above examples, you can use [variables] and <<*Options*>> text blocks to cascade a series of progressively narrower choices of clauses for selection by the end user. See Cascading for more information and a set of real world examples which you can copy and modify

The techniques discussed above allow the administrator to create questions and 'responses' which lead to the creation of a particular kind of document. Of course, this is a more complex application.  It will take some 'real' time to create. But once done, the 'logic' built into the program frees the end user from having to select actual clauses. Rather, the end user need only answer the questions posed. The administrator has 'pre-ordained' the actual text that is brought into the document based on the answer. The result is that uniformity in document production is assured.

While Pathagoras typically makes selections from various !groups! based on the position of the answer (if the 5th element of the first group encountered is selected, Pathagoras will select the 5th element from all other groups of the same name), it is possible to provide an !AskValue! prompt and to designate ranges (instead of positions) by which  text will be selected in the final document. See this page for more on the !AskValue! prompt.