Stepping - Data

It’s possible to modify the “looping” features in Docmosis so that the data can be looped through in small groups or steps.

The stepping feature can be used with the <<rs_ repeating sections or <<rr_ repeating rows directives.

By using the “:stepN” and “:stepNdown” directive, data will be arranged into smaller groups of size “N” while moving across a page or moving down a page. The “N” should be replaced with a number to indicate the size of the small groups or steps.

An array of colours: yellow, green, blue, purple, orange, pink and red, is passed to this template to illustrate how the “stepping across” and “stepping down” functions work.

IMPORTANT: When stepping Docmosis will automatically create the variables $i1, $i2, etc. – so that you can identify and work with each item of data during each step.

Docmosis will create enough variables to cover all of the items. For example, if you are stepping in groups of 5 – Docmosis will create $i1, $i2, $i3, $i4 and $i5.

Stepping across

The examples below demonstrate how to use step across.

Example 1

This example uses a Repeating Section to show the stepping-across function.

The “:step3” directive indicates to loop through the colours in small groups of 3.

For the first row, the $i1, $i2 and $i3 variables shown on the template will correspond with the 1st, 2nd and 3rd colours given in the data.

For the second row, $i1, $i2 and $i3 will correspond to the 4th, 5th and 6th colours.

In the third and final row, $i1 will correspond to the remaining 7th colour. The other variables $i2 and $i3 will be null and will produce no output in the final document.

Example 2

This example shows how stepping-across can be applied to Repeating Rows.

Here, stepping is applied to a table with a 4-across layout through a “:step4” directive.
$i1, $i2, $i3, $i4 correspond to the 1st, 2nd, 3rd and 4th colours in the array.

During the next step, $i1, $i2, $i3 correspond to the 5th, 6th and 7th colours in the array. The $i4 variable will be null and will produce no output in the final document.

Stepping down

The examples below demonstrate how to step down.

Example 3

In this example, the “:step2down” directive will arrange the colours downwards, filling the 2 columns evenly with data.

Docmosis automatically balances the data into the right number of rows, in this case 4 rows.

This results in the first four colours being shown in the first column and the remaining three colours being shown in the second column.

Example 4

Here the “:step3down” directive shows the colours displayed in a downward fashion again, this time “balanced” over 3 columns.

Note that the last four colours are “balanced” evenly over the second and third columns, with two colours in each column. This is instead of three colours in the second column and one in the third column.

Feedback

Invalid Input

Sorry, this field will only accept letters and numbers, and not special characters, to limit spam. Please also consider contacting support@docmosis.com if you need help with this article.

Sorry, this field will only accept letters and numbers, and not special characters, to limit spam.

Invalid Input

Related items