Conditioned output
No formatters can be chained after hideBegin
, hideEnd
, showBegin
, showEnd
.
By default, condition formatters have a special behavior, the formatter's result is not propagated to the next formatter if the result of the condition is true. This enables test chaining with Dynamic parameters.
Hide and show a part of the document with the following formatters:
hideBegin
/hideEnd
: hide text block betweenhideBegin
andhideEnd
if condition is true.showBegin
/showEnd
: show a text block between showBegin and showEnd if condition is true.ifEQ (value)
: Matches values that are equal to a specified value.ifNE (value)
: Matches all values that are not equal to a specified value.ifGT (value)
: Matches values that are greater than a specified value.ifGTE (value)
: Matches values that are greater than or equal to a specified value.ifLT (value)
: Matches values that are less than a specified value.ifLTE (value)
: Matches values that are less than or equal to a specified value.ifIN (value)
: Matches any of the values specified in an array or string.ifNIN (value)
: Matches none of the values specified in an array or stringifEM ()
: Matches empty values, string, arrays or objects.ifNEM ()
: Matches not empty values, string, arrays or objects.and (value)
:AND
operator between two consecutive conditional formatters.or (value)
: (default)OR
operator between 2 consecutive conditional formatters.show (message)
: print a message if a condition is true.elseShow (message)
: print a message if a condition is false.
Conditioned output example
Data
one = { d.status1:ifEQ(2):show(two):or(.status1):ifEQ(1):show(one):elseShow(unknown) }
two = { d.status2:ifEQ(2):show(two):or(.status2):ifEQ(1):show(one):elseShow(unknown) }
three = { d.status3:ifEQ(2):show(two):or(.status3):ifEQ(1):show(one):elseShow(unknown) }
Drop(element)
Compatibility
Supported file formats: DOCX
, ODT
, and PDF
.
when you use the
drop
formatter, the tag value is not printed and chained formatters are not executedto drop a group of elements, use hideBegin()/hideEnd() or showBegin()/showEnd()
use the
drop
formatter to delete elements from a document. The first argument passed to:drop(argument1)
is the element to drop
Use the following arguments to drop an element:
p
to drop paragraphs
usage:
{d.text:ifEM:drop(p)}
include the tag within a paragraph, and all the elements it comprises are also removed if the condition is validated (external help page)
row
to drop table rows
usage:
{d.data:ifEM:drop(row)}
include the tag in a table row, and all the elements it comprises are also deleted if the condition is validated (external help page)
Optionally, use nbrRowsToHide
to set the number of rows to drop as a second argument {d.data:ifEM:drop(row, nbrRowsToHide)}
, such as {d.data:ifEM:drop(row, 3)}
, meaning the current and next two rows is removed if the condition is validated.
By default, the formatter :drop(row)
hides only the current row.
img
to drop pictures
usage:
{d.img:ifEM:drop(img)}
include the tag within the image title, description, or alternative text (external help page)
chart
to drop charts
usage:
{d.dataset:ifEM:drop(chart)}
include the tag within the alternative text of the graphic (external help page)
shape
to drop shape (square, circle, arrows, etc.)
usage:
{d.dataset:ifEM:drop(chart)}
include the tag within the title, description or alternative text of the shape (external help page)
showBegin()/showEnd()
Shows a text block between showBegin
and showEnd
if a condition is true.
Use only break lines (shift
+ Enter
) between showBegin
and showEnd
.
Learn more about why conditional formatters are adding empty lines.
Data
Banana{d.toBuy:ifEQ(true):showBegin} Apple Pineapple {d.toBuy:showEnd}grapes
hideBegin()/hideEnd()
Hides a text block between hideBegin
and hideEnd
if a condition is true.
Use only break lines (shift
+ Enter
) between hideBegin
and hideEnd
. Learn more about why conditional formatters are adding empty lines.
Data
Banana{d.toBuy:ifEQ(true):hideBegin} Apple Pineapple {d.toBuy:hideEnd}grapes
and( value )
Changes the default operator between conditional formatters.
Example
{d.car:ifEQ('delorean'):and(.speed):ifGT(80):show('TravelInTime'):elseShow('StayHere')}
means "if d.car equals 'delorean' AND d.speed is greater than 80, then it prints 'TravelInTime', otherwise it prints 'StayHere'
Parameters | Description | Type |
---|---|---|
value | [optional] new value to test | mixed |
or( value )
Changes the default operator between conditional formatters.
Example
{d.car:ifEQ('delorean'):or(.speed):ifGT(80):show('TravelInTime'):elseShow('StayHere')}
means "if d.car equals 'delorean' OR d.speed is greater than 80, then it prints 'TravelInTime', otherwise
it prints 'StayHere'
Parameters | Description | Type |
---|---|---|
value | [optional] new value to test | mixed |
ifEM( )
Matches empty values, string, arrays or objects (null, undefined, [], {}, ...).
Examples
ifNEM( )
Matches not empty values, string, arrays or objects.
Examples
ifEQ( value )
matches all values that are equal to a specified value
can be combined with other formatters to create conditional content
returns the initial marker
the state of the condition is not returned
Parameters | Description | Type |
---|---|---|
value | value to test | string, integer |
Examples
ifNE( value )
matches all values that are not equal to a specified value
can be combined with other formatters to create conditional content
returns the initial marker
the state of the condition is not returned
Parameters | Description | Type |
---|---|---|
value | value to test | string, integer |
Examples
ifGT( value )
Matches values that are greater than a specified value.
Parameters | Description | Type |
---|---|---|
value | value to test | integer |
Examples
ifGTE( value )
Matches values that are greater than or equal to a specified value.
Parameters | Description | Type |
---|---|---|
value | value to test | integer |
Examples
ifLT( value )
Matches values that are less than a specified value.
Parameters | Description | Type |
---|---|---|
value | value to test | integer |
Examples
ifLTE( value )
Matches values that are less than or equal to a specified value.
Parameters | Description | Type |
---|---|---|
value | value to test | integer |
Examples
ifIN( value )
Matches any of the values specified in an array or string.
Parameters | Description | Type |
---|---|---|
value | value to test | integer |
Examples
ifNIN( value )
Matches none of the values specified in an array or string.
Parameters | Description | Type |
---|---|---|
value | value to test | integer |
Examples
show( message )
prints a message if the condition is true
use with other formatters to print conditional content
Parameters | Description | Type |
---|---|---|
message | message to print |
Examples
elseShow( message )
print a message if the condition is false
use with other formatters to print conditional content
Parameters | Description | Type |
---|---|---|
message | message to print |
Last updated