More descriptive answers in your Choose commands on the XpressDox interview
Many of the examples of “Choose…” commands in the XpressDox Learning Center are of the nature of choosing “Yes” or “No” values, or other short values.
But another important branch of Document Assembly is the inclusion or exclusion of paragraphs or clauses depending on some or other set of criteria. Sometimes these criteria are inferred from the kind of terse “Yes” or “No” choices referred to above. But sometimes we need the user to choose the clause explicitly.
Radio buttons (where only one answer is required)
Here is an example of the inclusion of a clause referring to collateral being provided or not, which is a reasonable way to achieve the desired text in the document:
«ChooseFromRDBList(CollProv,Yes,No)»
«Caption(CollProv,Collateral to be provided)»
«If(CollProv = "Yes")»
Collateral is to be provided by the signatory.
«Else()»
No collateral is required.
«End()»
Another way would be:
«ChooseFromRDBList(CollProv,Collateral is to be provided by the signatory,No collateral is required)»
«Caption(CollProv,Collateral to be provided)»
«CollProv»
Sometimes, for the user to make an informed decision about the correctly choice to make, the only way is to include entire text of each clause in the RDB list!
The parcel is to be delivered by courier because:
«ChooseFromRDBList(Clause,
I do not trust the postal service to protect it from damage,
In this case the courier is the cheapest option,
Although the postal service is trustworthy and the courier is more expensive!, the courier reception depot is closer than the post office)»
«Clause».
This is acceptable if the text is inserted directly into the document. But suppose the result of the choice is to be used again in one or more If commands. It would make for very clumsy, easy to misspell, If statements! In this case, a short-hand way of constructing If statements, using the ~~ would come in very handy:
The parcel is to be delivered by courier because:
«ChooseFromRDBList(ClauseCode,
NoTrust~~I do not trust the postal service,
Cheap~~The courier is the cheapest option,
Close~~The courier reception depot is closer than the post office)»
«If(ClauseCode = "NoTrust")»
I do not trust the postal service to protect it from damage.
«End()»
«If(ClauseCode = "Cheap")»
In this case the courier is the cheapest option.
«End()»
«If(ClauseCode = "Close")»
Although the postal service is trustworthy and the courier is more expensive, the courier reception depot is closer than the post office.
«End()»
Note the following:
1. The character ! before the comma in the third choice is an escape character, and is used to tell XpressDox that the comma following it is to be used as part of the text of the choice, and not to indicate the boundary between two choices in the list. The ! will not be included in the value chosen for the data element.
2. In the second RDB list, the choices appear each on a separate line. This can be coded into a Word document using the “soft line space” (<Shift Enter>). This renders the RDB list more readable, and the soft line spaces will not appear in the merged document.
Checkboxes (where more than one answer is required)
Another example would be a kind of menu situation, where the user can choose more than one of a list of options. In this case an RDB List is not the answer, as by its nature an RDB list permits only one choice to be made. Here is an example of a multiple choice, using ChooseUsingCheckBox. Note how the ~~ delimiter causes the text to the right of it to be displayed to the right of the check box (as against the ? which would otherwise appear)
S/he is a vegetarian because:
«ChooseUsingCheckBox(Veg1,~~Health reasons)»
«ChooseUsingCheckBox(Veg2,~~Doesn't enjoy eating meat)»
«ChooseUsingCheckBox(Veg3,~~Deforestation in order to make way for the cattle ranches is causing global warming)»
1. «ShowIfHasValue(Veg1)»
2. «ShowIfHasValue(Veg2)»
3. «ShowIfHasValue(Veg3)»
Note:
1. The ! before the quote in the second check box is an “escape” character – it tells XpressDox that the quote is to be used in the value of the option, and not as a string delimiter in the command. The ! itself won’t appear in the data element value.
2. Note that if Word paragraph numbering is used to number the numbered paragraphs above, then the correct paragraph numbering will appear in the merged document.
3. If the checkbox is checked, the “Y” value i.e. the verbose text will be inserted into the assembled document.
In order to remove the original caption of the checkbox, you may want to add this to your template. That will also bring the checkbox over to the left hand side of the interview.
«Caption(Veg1,@@)»
«Caption(Veg2,@@)»
«Caption(Veg3,@@)»
Other mechanisms for selecting clauses in the data capture dialog are discussed in the article Conditional inclusion of paragraphs and clauses.