Search

April 24, 2026

BuildList Function

Similar to the List command, BuildList produces a delimited list from a repeating data element. The key difference is that BuildList is a function, which means it can be used inside other commands and expressions, not just as a standalone fillpoint.

 

Syntax

«BuildList(repeat,data_element,separator,delimiter,last_delimiter)»
Parameter Description
repeat The name of the repeating element
data_element The data element within the repeat to list
separator The separator between all items except the last two (use ! before a comma)
delimiter The separator before the second-to-last item
last_delimiter The separator before the last item (e.g. and )
Note: To escape characters, as with the List command, a comma in any delimiter parameter must be prefixed with! because commas are used by XpressDox as parameter delimiters.

 

Basic example

To produce a comma-separated list of party names ending with “and”, the code would look as follows:

«BuildList(Person,Name,!, , and )»

Output: Harry Potter, Juliet Jones and Fred Basset

 

Using expressions with BuildList

Because BuildList is a function, other functions can be applied to it in various ways. You can, for example, wrap a function around the data element inside BuildList:

«BuildList(Person,ToUpper(Name),!, , and )»

Output: HARRY POTTER, JULIET JONES and FRED BASSET

 

Or you can wrap a function around the entire BuildList:

«ToUpper(BuildList(Person,Name,!, , and ))»

Output: HARRY POTTER, JULIET JONES AND FRED BASSET

 

Using BuildList inside other functions

BuildList can also be embedded inside larger expressions, for example inside an IIf or concat:

«IIf(DepartmentDetailsRequired = 'Y',iif(InsuredEntity != '',concat(' the ',InsuredEntity),concat(' the ',BuildList(Department_details,DepartmentName,!, , and ))),ClientFullName)»

In this example, BuildList is called inline as part of a larger expression, only when InsuredEntity is empty. This would not be possible with the List command.

 

Using BuildList to generate a list in the interview

BuildList can also be used within the interview itself – either to store a list as a visible value, or to drive a dynamic caption or heading. In both cases the delimiter choice determines the output format. In the example below, a repeating group captures each defendant’s details, and a Set command uses BuildList to build the list:

«ForEach(Defendant)»
«ChooseFromHzRDBList(PartyType,Individual,Company)»«CaptureDataElement(PartyType)»
«If(PartyType = 'Individual')»
«ChooseFromHzRDBList(Title,,Ms,Mrs,Mr)»«CaptureDataElement(Title)»
«Surname»
«ElseIf(PartyType = 'Company')»
«CompanyName»
«End()»
«Set(DefendantName,(),IIf(PartyType = 'Individual',concat(Title,' ',Surname),CompanyName),'')»
«HideInsideIV(DefendantName)»
«End(Defendant)»

As a value:

The result is stored and displayed as a readable field in the interview:

«Set(DefendantList,(),BuildList(Defendant,DefendantName,', ',' and '),'')»

As a heading in the interview:

The same approach, but the result is used in a Heading command to display a live, dynamic label that updates as defendants are captured:

«Set(DefendantCaption,(),BuildList(Defendant,DefendantName,', ',' and '),'')»
«PlaceHolder(PH_DefendantCaption,Normal PlaceHolder)»
«Heading(PH_DefendantCaption,<p>The Defendant(s) in the matter: <span style="font-family: Arial, sans-serif; font-size: 10pt;">&lt;DefendantCaption&gt;</span></p>)»
«HideInsideIV(DefendantCaption)»

 

See related articles: