Example how to generate a table in a template based on a nested template?
Quite often, it is necessary to pass several lines to a print template that have the same appearance but different content.
For example, an invoice — it has a header and a line part listing the items.
To make this work, we need to create a template of type Element, and in the top template, place a variable that will be replaced by the nested template.
Now we call the print with the nested template and pass rowlist to it:
=: linkToPrint(template: "template_name"; data: $row)
row: rowCreate(field: "rowlist_var" = $row_inner_template)
row_inner_template: rowCreate(field: "template" = "inner_multi_template"; field: "data" = $inner_rowlist)
inner_rowlist: rowListCreate(field: "column_1" = "LIST_DATA_1"; field: "column_2" = "LIST_DATA_1")
template_name — top template
rowlist_var — variable in the top template that will be replaced by the nested table
row_inner_template — row with keys
template — name of the nested template
data — rowlist with data for filling. Each row of this rowlist will create a copy of the template passed in template.