Sections

Sections could be used to show or hide part of document. It could be paragraph / table row / list item or whole document page. Sections differ from fields that has starting and ending point. Section n

Example - usage of section

Simple Section

Section w/o fields is detected when there is no additonal fields provided within section. Simple sections are visible in form as checkbox fields.

{#isUnderage}
Member is underage
{/isUnderage}

Simple section (no fields defined)

Dear {name},
{#isUnderage}
User {name} is underage
{/isUnderage}

Simple section (only field is inherited from upper level)

Inverted Section

If you want to show block of document when section is undefined (unchecked/list not provided) feel free to use “^” special section tag.

{#isUnderage}
Member is underage
{/isUnderage}

{^isUnderage}
Member is an adult
{/isUnderage}

Sections with Fields

Sections could consist of additional fields that are valid per each section.

One-block / Repeated block

Sections could work to show/hide part of document conditionally once or repeat part of document multiple times based on form input.

Upper Level Fields

If you use exact same field names as in upper context value will be inherited from upper level and omitted as part of the section.

Conditional part of document with additional fields

You can create sections with fields to show/hide part of the document. If we detect additional fields within section user will be asked for filling in additional fields.

{#isUnderage}
Member is underage.
Parent Name: {parentName} Parent Phone: {parentPhone}
{/isUnderage}

Fields “parentName” and “parentPhone” will appear on form only if section field will be selected.

Table Rows using Sections (Repeated Block)

You can use sections with fields to define rows in table. As a template you just need to use one table row.

In first column include section start tag, in last columns use section close tag

Product Name
Product Category
Price per item

{#products} {name}

{category}

{price} {/products}

You can create sections / table summaries combining sections and smart fields and filters (You should use them outside of the section/columns definition)

Example:

{$ products.length } - Display number of items in section 'products'
{$ products.length ? 'Products Exist' : 'No products' } - Show text if there are items added to section 'products'
{$ products.length > 1 ? 'There are multiple products' : 'No products' } - Show messages based on the number of items in section 'products'

Example with sum filter:

{$ products | sum:'price'} - sums up a field 'price' from all the items in section 'products'
{$ products | sum:'quantity'} - sums up a field 'quantity' from all the items in section 'products'
{$ products | sum:'price*quantity | format'} - sums up a 'price' multiplied by 'quantity' and from all the items in section 'products, round up to 2 decimal points using filter 'format'
You can also sum only specific items from your sections based on condition using additional "filter"
{$ products | filter:' category == "car" ' | sum: 'price'}  - sums up a field 'price' from all the items in section 'products' that 'category' property is set to 'car'

Please remember to wrap your expression after sum: into quotes!

Example usage in table:

Product Name
Product Category
Price per item

{#products} {name}

{category}

{price} {/products}

No of Products: {$products.length}

Total: {$ products | sum:'price'}

In the example above there is an extra footer row added to the table (outside of the section) indicating how many products are in the table and another one that sums up a field 'price' from all the rows

Product Name
Product Category
Price per item

{#products} {name}

{category}

{price} {/products}

Subtotal: {$ subtotal = products | sum:'price'}

Total (with 23% VAT): {$ subtotal * 1.23 | format}

In the example above there is an extra footer row added to the table (outside of the section) that sums up a field 'price' from all the rows displays it and saves it as a "subtotal" template variable, then the variable is used to calculate Total value in Smart Section and formatted accorindgly.

Loop items (Repeated Block)

You can create any blocks, paragraphs, cards, or mini table and use it as template. Whole template block will be repeated amount of times it’s repeated in input form.

See example below.

{#products}
Product: {name} | Category: {category}
Desc:
{desc}
--------------------------------------
Price: {price}
{/products}

Special field for ordinal number - $iterator (Repeated Block)

You can use special smart tag “{$iterator}”. It could be used within section template.

For each section it will generate consecutive numbers: 1,2,3,4 without need to enter them manually as a field.

Product Number
Product Name
Product Category
Price per item

{#products} {$iterator}

{name}

{category}

{price} {/products}

Last updated