AskRepeat with Options
When you ask for the number of repeats for a particular operator, Pathagoras will dutifully record the number of repeats and apply the result to other repeat block throughout the document. (5 children, it will create [Child1],[Child2], etc., blocks in the appropriate places throughout your document.
But what if what you also need is 'optional' text (not repeating text) based on the number of something. For example, if there are no children of the marriage, choose an appropriate clause, if there is one child, choose a different clause and if there are 2 or more children, choose yet a different clause. This page addresses that.
Let's start with some sample text:
<<*AskRepeat*!Children!*>> <<*AskRepeat*!Bene!*>> (The above would appear at the top of the document. Pathagoras will always ask 'Ask' blocks first.)
Last Will and Testament of [Testator Name] . . . A. Family: <<*Options*!Children!*I have no children/I have one child whose name is/I have <<*Repeat*!children!Return*two>> children and their names are <<*Repeat(and)*!children!*[Child]>>>>. . . . <<*Options*!Children!*/ G. All trust assets shall be distributed to my child named in paragraph A if that child is alive at the time of my death. If my child is not alive at the time of my death, but has surviving descendants, the share that would have gone to such child shall be distributed to such child’s descendants, per stirpes./ G. All trust assets shall be distributed to each child named in paragraph A if that child is alive at the time of my death. If a child of mine is not alive at the time of my death, but has surviving descendants, the share that would have gone to such child shall be distributed to such child’s descendants, per stirpes.>> <<*Options*!Children!* H. All assets shall be distributed to <<*Repeat(and)*!Bene![AltBenef Name] residing at [AltBenef Address]>>, if that beneficiary is alive at the time of my death<<*Options*!Bene!*// ,in equal shares>>. If a named beneficiary should not survive me, such shares shall be distributed to such beneficiary’s descendants, per stirpes./ H. If my child named in paragraph A, and no descendant of such child, shall survive me, all assets shall be distributed to <<*Repeat(and)*!Bene![AltBenef Name] residing at [AltBenef Address]>>, if that beneficiary is alive at the time of my death<<*Options*!Bene!*// ,in equal shares>>. If a named beneficiary should not survive me, such shares shall be distributed to such beneficiary’s descendants, per stirpes./ H. If no child named in paragraph A, and no descendant of any such child, shall survive me, all assets shall be distributed to <<*Repeat(and)*!Bene![AltBenef Name] residing at [AltBenef Address]>>, if that beneficiary is alive at the time of my death<<*Options*!Bene!*// ,in equal shares>>. If a named beneficiary should not survive me, such shares shall be distributed to such beneficiary’s descendants, per stirpes.>> |
Note the following.
Paragraph A. contains 3 options that will be processed based on the number of children selected with the AskRepeat call. Notice that the text that will be returned is not based on the 'position' of the AskRepeat number. That is, if '1' is the response to the ask repeat, the Option in position #1 is not what will be returned. When you study the example, you will see that that would make no sense. Read on:
EXCEPTION TO THE "POSITION" RULE" Normally, !grouped! options are processed by ‘position’. Whether you select the 1st member of the group or the 15th, the same ‘position’ of other members of the group is selected. However, when Repeats are !grouped! with an <<*Options*>> block, the selected option is processed based on an analysis of the actual number provided.
Zero: If the ‘repeat’ number is 0, the option text in position 1 of the <<*Options*>> block with the same !groupname! is processed.
One: If the ‘repeat’ number is 1, the option text in position 2 of the <<*Options*>> block with the same !groupname! is processed.
Two or more: If the ‘repeat’ number is 2 or higher, the option text in position 3 of the <<*Options*>> block with the same !groupname! is processed.
There is a real logic behind this operation and it deals with noun/verb pairings:
If there are ‘none’ of something, the plural is used to describe this ‘nothingness.’
If there is 'one' of something, the singular is used.
If there are '2 or more', the plural is used.
For example:
“There are no children. There is one child. There are 3 children.”
Further, the actual text (if any text is provided at all) may vary greatly based on the number of children, shareholders, quantity ordered, etc.
So, when using the same !groupname! with a <<*Repeat*>> block and an <<*Options*>> block, simply set out the appropriate choices for the '0', '1' and '2+', possibilities, separating each choice with slashes.
If there is no appropriate text to display for one of the choices, you will still need the slash as a holding spot. See just above Paragraph G ('0' children requires no text), and see in Paragraph H near the !bene! group ((there is no ‘equal shares’ possibility for ‘0’ or ‘1’ beneficiary).
"But what if I need separate paragraphs based on all of possibilities reflected in the AskRepeat answer?" Sorry, but we simply cannot help. We had to make a decision as to how best to process the 'repeat' answer and could not conceive of the above situation where a user would need 10 'Options' choices if '10' was the answer to the AskRepeat. (If you simply need to return the number '10' within the Options text, that is easy enough to set up. See Returning the Repeat value.)