Search

List – XpressDox

List repeating data in a comma separated list

This is what the «List»() command does and might look like this:

The parties are: «List(parties,firstnames surname,!, , and )»

In some sample XML data set, suppose we have:

<parties>
<firstnames>Harry Charles</firstnames>
<aka>Charlie</aka>
<parties>
<firstnames>Juliet Charlene</firstnames>
<surname>Jones</surname>
<aka>Charley</aka>
</parties>
<parties>
<firstnames>Fred Reggie</firstnames>
<surname>Basset</surname>
<aka>Freddie</aka>
</parties>

The names in our example would be rendered:

Harry Charles Potter, Juliet Charlene Jones and Fred Reggie Basset

Note the ‘!’ in front of the comma. This is an escape character and is required before a comma, or left or right parenthesis whenever that character is required as is in the output text.

This is because the characters ‘,’ ‘(‘ and ‘)’ are used by XpressDox as command and function parameter list delimiters. This means that, if any of those three characters are required to be in the printed output (as is the case with the comma above), then they must be prefixed by !

Notice that the syntax of the command is such that the second parameter is essentially a list of data element names, or function results, separated by spaces. Thus commands like this are possible:

1. «List(parties,ToUpper(firstnames) ToUpper(surname),!, , and )»
giving
HARRY CHARLES POTTER, JULIET CHARLENE JONES and FRED REGGIE BASSET

2. «List(parties,ExtractInitials(firstnames,'.') ToUpper(surname),!, , and )»
giving
H.C. POTTER, J.C. JONES and F.R. BASSET

3. «List(parties,ExtractInitials(firstnames,'.') Use('aka') aka ToUpper(surname),!, , and )»
giving
H.C. aka Charlie POTTER, J.C. aka Charley JONES and F.R. aka Freddie BASSET