Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
To repeat a section of a document, for example rows, title, or pages, use a "repetition example" with the reserved key word i
and i+1
.
It's not necessary to define where the repetition starts and ends.
The pattern is automatically found and repeated using the first row (i
) as an example. The second row (i+1
) is removed before rendering the result.
Repeat nested arrays are managed at unlimited depth. The following example shows a repetition of a whole document.
It is not necessary to completely repeat the first paragraph twice in the template—repeat only the title of the second paragraph to detect where the repetition pattern of the main array ends {d.cars[i+1].brand}
.
The bi-directional loop performs iterations in 2 directions, creating additional columns and rows.
The feature depends significantly on the XML coming from the document.
If the table is badly formed, there may be issues recognizing the elements to repeat, which in turn may create a corrupted document.
{d[i].models[i].brand} | {d[i+1].models[i].brand} |
---|---|
Toyota | Tesla | Lumeneo |
---|---|---|
Use conditional operators to filter arrays: >
, <
, >=
, <=
, =
, !=
.
Filters should be the same on the ith+1
marker and all other markers if you want to keep only matching rows. Use an to simplify report maintenance.
People |
---|
People |
---|
Filter with strings as shown in the example below.
Filter the loop index as shown in the example below.
People |
---|
People |
---|
People |
---|
People |
---|
{d[i].models[i].size}
{d[i].models[i+1].size }
Prius 2
Prius 3
S
X
{d.cars[power].brand}
{d.cars[power+1].brand}
Tesla
Toyota
Lumeneo
{d.cars[i].brand}
{d.cars[i+1].brand}
Lumeneo
Tesla
Toyota
{d[i].models[i].name}
{d[i+1].models[i].name}
{d[i].models[i+1].name }
{d[i+1].models[i+1].name }
Prius 2
S
Smera
Prius 3
X
Néoma
|
|
Falcon 9 |
Falcon Heavy |
|
|
Falcon 9 |
Model S |
|
|
Tesla |
Airbus |
|
|
John |
Bob |
|
|
Tesla |
Toyota |
Airbus |
Boeing |
Access the iterator value when a list is printed into a document.
In {d[i].cars[i].other.wheels[i].tire.subObject:add(.i):add(..i):add(...i)}
The number of dots equals the number of previous i
:
.i
matches the index value of wheels[i]
..i
matches the index value of cars[i]
...i
matches the index value of d[i]
{d.myObject[i].att}
{d.myObject[i].val}
{d.myObject[i+1].att}
{d.myObject[i+1].val}
paul
10
jack
20
bob
30