Building a formatted list in a template from one or more form repeats (\BuildList)

As discussed elsewhere, it is possible to use the BuildList() function in a form to build a well formatter list from data within a repeat.

For example, if you have a repeat called Name_rpt which contains a text field Name_txt, you can build a formatted list from the values entered into the Name_txt field. So if the user enters, Andrew, Alex, Edward into the Name_txt field, you can build a formatted list such like “Andrew, Alex and Edward.“, with the commas and ‘and’ in the correct place.

But you can also build a formatted list within the template itself, i.e. after the form has been completed and submitted. You do this using the BuildList switch in a mergefield within your template.

The syntax is as follows:

{ MERGEFIELD List_Name \BuildList [Name_rpt,Name_txt] }

This will build a formatted list in your template using the values entered in the Name_txt field within the Name_rpt repeat.

You can also filter the values in the repeat to only include rows within the repeat that meet a given criteria.

For example, say you have another field in the repeat Include_yn. You can then filter what Name_txt values get included in the list using the following syntax:

{ MERGEFIELD List_Name \BuildList [Name_rpt,Name_txt,Include_yn=’true’] }

You can also include values from more than one repeat within your form. Let’s say you have another repeat called Relatives_rpt, and this has a field called Relative_txt into which you can write the names of relatives to the persons included in the Name_rpt repeat.

Using values from more than one repeat

To create a formatted list that includes the values from both Name_txt and Relatve_txt you would use the following syntax:

{ MERGEFIELD List_Name \BuildList [Name_rpt,Name_txt][Relative_rpt,Relative_txt] }