Index
Video Courses
Watch structured video courses
Knowledge Base
Visit our User Forum for discussions & solutions
ChooseFromRepeatingData
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.
Example 1: Choose one of the previously entered repeating parties
«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»
Example 2: Choose one of the previously but show a different data element in the drop down list
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.
Example 3: AddAllChosenData
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»
Example 4: Choose multiple parties from previously entered repeating parties
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)»
Example 5: Join together multiple ForEach’s and select one or many parties from the combined list
«ForEach(Plaintiff)»
«FullName»
«End()»
«ForEach(Defendant)»
«FullName»
«End()»
«ForEach(Deponent)»
«ChooseFromRepeatingData(FullName,../Plaintiff | ../Defendant/FullName,,AddAllChosenData)»
«FullName»
«End()»
Example 6: Set an ID for each of the repeated parties and print from the ID
This example shows how you can avoid creating an entirely new set of data in your dataset for your new selection, but instead always print from the original source of data. Set an ID for each of the repeating parties using the XpressDox Guid() function. You can use the Set command, or OnExit/OnEnterSet for this. When you select your parties in the ChooseFromRepeatingData, match the ID against the newly selected ID. It means that if the user makes any changes to the data in the repeat, they don’t have to reselect that data in the drop down list. Instead, because the template is only matching ID’s, it will pick up the latest data from the repeat. Note how this example uses the “AddChosenDataElementOnly” parameter. Should you wish to print other elements simply repeat the last line in this example. This might be a good use case for a script.
Plaintiffs:
«ForEach(Plaintiff)»
«FullName»
«Set(ID,(),Guid(),)»
«End()»
Defendants:
«ForEach(Defendant)»
«FullName»
«Set(ID,(),Guid(),)»
«End()»
Deponent:
«ChooseFromRepeatingData(DeponentID,Plaintiff/ID | Defendant/ID,FullName,AddChosenDataElementOnly)»
«CaptureDataElement(DeponentID)»
«(Plaintiff[ID = ../DeponentID] | Defendant[ID = ../DeponentID])/FullName»
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.