logo

Display of a Block variable in a document template

Say you have a Goods variable of the Block type, which has two properties: Name and Quantity. To display the values of this variable in a template, use:

{for Item in{$Goods}}
{$Item.Name}: {$Item.Quantity} pcs.{end}
Instead of Item you can use any other string identifier. It is used to refer the properties inside the block.
When adding a block to a template, you can use the following functions: 
Count - {Count({$Goods})}, inside a block cycle you can also use {Count({$Item})}. 
Index (start with 0) - {Index({$Item})}

If you need to display the content of a block in a table, for example, in a .doc file, then you should place the start and end of the block declaration outside the table (i.e. {for Item in {$Goods}} and {end}), and place the properties in the created table row. After generating a file by the template, as many table rows will be created as there are items in the block.
In case of an Excel file, insert the following lines in the first column of the document:

{for Item in {$Goods}}
{end}