There is a requirement in some templates for the interview user to be able to check a checkbox and have a set of check boxes all checked – a so-called “Check All” feature.
A similar requirement applies to a set of radio button lists, which must all have a value chosen when a “select all” radio button list has a value chosen.
This can be achieved using a set of OnExitSet commands applied to the “check all” control – which is then called the trigger – and these OnExitSet commands set the relevant values of the other controls, called the targets.
However, the DefineSetAllGroup command is a very useful shorthand to creating this “set all” group.
For example, suppose there are 5 data elements, each referring to a day in the working week. These five are to be presented as check boxes so that the interview user can choose any number of these days as, say, a delivery day. It would then be nice to have a separate check box that could set all of those 5 to be checked (or unchecked) to help the user make the correct selection without having to check them all separately.
What needs to happen is that the 6 check boxes need to be set up in whatever way the template author chooses – i.e. with or without headings, footings, verbose indicators, horizontal or vertical. Then the DefineSetAllGroup command sets up the “check all” relationship and behind the scenes defines the necessary OnExitSet parameters to implement the required action. In this example of five working days, a typical setup would be:
Notice that the trigger is the data element in the first parameter of the DefineSetAllGroup, and the following data elements are the targets (whose values will be set when the trigger’s value is set).
To make things clearer to the interview user, some Captions might be in order:
«Caption(CheckAll,Check/Uncheck all days)»
And perhaps the whole lot put into a horizontal group:
There are many possibilities, but the same DefineSetAllGroup applies to all variations that the template author might come up with.
Radio Button Lists
The above discussion applies equally to radio button lists, for example:
Note that when the trigger’s value is set, it is not the trigger’s value that the targets are set to, but the targets are each set to their value which corresponds in position to the trigger’s value. So, for example, in a group of radio button lists, if the second item in the trigger list is chosen, then the targets are all set to whatever is the second item in each of their lists.
Create and Output a Delimited List
Suppose we need to allow the user to choose the swimming strokes that they employ (as above), but in the order in which they excel, and then output those into the merged document as part of the following text:
I would like to enter the swimming events. In order of preference, these are: free style, backstroke and lastly butterfly.
This could be achieved by the following:
«ChooseUsingCheckBox(Chk1,~~free style,|,|)»«Caption(Chk1,' ')»
and then later:
I would like to enter the swimming events. In order of preference, these are:
«CommasAndList(ListOfStyles,'|',', ',' and lastly ')»
Notice that the format of the DefineSetallGroup with the delimiter as the second last parameter, will cause the selected values of the check boxes to be placed into the last parameter (in this case the data element ListOfStyles) using the delimiter to separate them. The values will be recorded in the sequence in which the user chooses them.
It’s easy enough to suppress the “Check All” functionality by including the command
Putting the SetAll group into a DropDownPanel
With effect from version 5 of XpressDox, it is possible to combine the commands DefineSetAllGroup and DropDownPanel so that the SetAll group will be placed in its own drop down panel. This effectively creates what is sometimes known as a “multiple-choice dropdown”. All that is needed is to supply the name of the drop down panel placeholder data element as the last parameter to the DefineSetAllGroup, after the list delimiter and list positions. Applied to the above examples, this would look like: