October 1, 2009

ChooseFromRepeatingData - XpressDox

Present a drop-down list in your XpressDox template

 

Note: ChooseFromData and ChooseFromRepeatingData are the same command.

 

This command will present a drop-down list of values in the interview. This is similar to the action of the ChooseFromList command, except that the values to be displayed are not provided at template authoring time, but are contained in the data set which exists at the time the drop-down arrow is pressed.

 

Some examples:


«Comment(capture parties and choose one as a signatory. Print the name only.)»
«ForEach(Parties)»
«FullName», «SS_Num»
«End()»
«ChooseFromRepeatingData(NameOfSignatory,Parties/FullName)»

Name of signatory: «NameOfSignatory»

Another example: suppose not the name but the Social Security Number of the signatory is needed, and this is to be chosen using the ChooseFromRepeatingData command. The user must be presented with a list of the parties’ names, but the data element to be set is the Social Security Number. The following command would be used, introducing a third parameter, being the name of the repeating data element whose value should show in the drop down:


«Comment(capture parties and choose one as a signatory. Print the SS num only.)»
«ForEach(Parties)»
«FullName», «SS_Num»
«End()»
«ChooseFromRepeatingData(SSNumOfSignatory,Parties/SS_Num,FullName)»

Social security number of signatory:«SSNumOfSignatory

This has the effect that, in addition to the Social Security Number of the chosen Parties repeater being added to the data set, ALL of the sub-elements of the relevant Parties repeater are added to the data set, at the level in the data of the SSNumOfSignatory data element.  This makes it very easy to refer to those other sub-elements, rather than, as in the past, having to refer to them via XPATH predicates.

 

It could, however, be tedious to do a ChooseFromRepeatingData each time you need an element from the repeated set of data. Instead, use the parameter “AddAllChosenData” along with the command, like this:


«Comment(capture parties and choose one as a signatory. Print all info from the item chosen)»
«ForEach(Parties)»
«FullName», «SS_Num»
«End()»
«ChooseFromRepeatingData(NameOfSignatory,Parties/FullName,,AddAllChosenData)»

Name and Social security number of signatory:
«NameOfSignatory», «SS_Num»

 

Another example is that you can also select multiple parties from previously captured parties. Perhaps you’ve already captured multiple Directors, and now in a new list you need to capture Shareholders but there may be an overlap.


«Comment(capture Directors in a repeat. Then select Shareholders from the repeated Shareholders.)»
«when(count(Director) > 1,Directors,Director)»
«ForEach(Director)»
1.	«Name», «Residential_Address», «E-mail»
«End()»
 
«when(count(Shareholder) > 1,Shareholders,Shareholder)»
«ForEach(Shareholder)»
«ChooseFromData(Name,../Director/Name,,AddAllChosenData)»
1.	«Name», «Residential_Address», «E-mail», «TelNum»
«End()»
«Comment(you can use a grid capture if you want to)»
«CaptureInGrid(Director,Yes)»
«CaptureInGrid(Shareholder,Yes)»
«Comment(put a caption on the repeats)»
«RepeaterCaption(Director,Director details)»
«RepeaterCaption(Shareholder,Shareholder details)»

 

The ChooseFromDataElements command can be used to populate a drop-down with data from the data set where the source data is not from a repeating set.

 

The command ChooseFromRepeatingData is exactly the same as ChooseFromData and was introduced to make the distinction between it and ChooseFromDataElements more obvious.