Related topics:


Tutorial Videos

Tutorial videos are available here.

Knowledge Base

Visit our User Forum for discussions & solutions

ChooseFromDataset – XpressDox

Please note that this command has not yet been fully implemented in the web as yet.

We have a ChooseFromRepeatingData command (which is the same as ChooseFromData, but is a more descriptive name), and a ChooseFromDataElements command. The ChooseFromDataset command combines the functionality of the other two, and adds some more flexibility.

The first argument is the name of the data element to be chosen. This is as per convention. The following arguments are in pairs – an XPATH to a particular choice, then an optional XPATH to the value to be shown in the drop down for that choice.

A simple example would be an interview which contains the names of the children in a family, a list of their friends, and the names of the parents. We would like to choose the name of the person most likely to be president. Here’s what the interview construction part of the template might look like:


The items in the drop down would then be the Father’s name, the Mother’s name, followed by <each of the children’s names>, <each of the friend’s names>. When the user chooses an item in the drop-down, the value placed into President would be the corresponding value of the data elements Father, Mother, the chosen Child or the chosen Friend‘s name.

Look at what would happen if you replace the above ChooseFromDataset with the following:

«ChooseFromDataset(President,Father,'The Father',Mother,'The Mother','','CHILDREN and FRIENDS',(Child | Friend)/Name)»

This would display the text ‘The Father’ and ‘The Mother’ instead of the Father and Mother’s names (respectively), and put a “heading” between the Mother and the Child and Friend items. And yet the values chosen, and placed in the dataset, will be exactly as for the first example.

More Advanced Syntax

As with many of the XpressDox commands and functions, the power of XPATH is available to the template author. For example, the following command will achieve the same result as the first one:

«ChooseFromDataset(President,Father,'The Father',Mother,'The Mother','','CHILDREN and FRIENDS',(Child | Friend)/Name)»

Or, perhaps, you only want to present the children where the age is greater than 18 (which, obviously, would require capturing the Age inside the Child part of the interview):

«ChooseFromDataset(President,Father,'The Father',Mother,'The Mother','','CHILDREN and FRIENDS',Child[Age > 18]/Name,,Friend/Name)»