Booleans

Prev Next

Displays boolean values in different ways, for example through colored labels, or icons.

Booleans

How it works

This filter and its variants can be applied to metrics and properties template elements.

Depending on the type, the filter input value is automatically converted to a boolean and then displayed according to the selected variant options.

Value Type

Expected True Values

Expected False Values

BOOLEAN

true

false

INTEGER

1

0

STRING

"true", "1", "yes"

"false", "0", "no"

The string case is ignored (e.g. "True" -> true).

Null or empty values are always handled as false.

Without this filter, the values of metrics/properties are printed as they are according to the underlying value type, for instance:

Filter Variants

The set of predefined filter variants that can be used to format values.

Green/Gray Led

Converts the boolean value into a GREEN or GRAY led.

Name: greenGrayLed

Input Types: BOOLEAN, STRING, INTEGER

Output Type: HTML

Green/Red Circle

Converts the boolean value into a GREEN or RED circle.

Name: greenRedCircle

Input Types: BOOLEAN, STRING, INTEGER

Output Type: HTML

OK/Error

Converts the boolean value into a colored Ok or ERROR text.

Name: okError

Input Types: BOOLEAN, STRING, INTEGER

Output Type: HTML

OK/Error Badge

Converts the boolean value into a colored Ok or ERROR badge.

Name: okErrorBadge

Input Types: BOOLEAN, STRING, INTEGER

Output Type: HTML

On/Off Icon

Converts the boolean value into a POWER-ON or POWER-OFF icon with status text.

Name: onOffIcon

Input Types: BOOLEAN, STRING, INTEGER

Output Type: HTML

Red/Gray Circle

Converts the boolean value into a RED or GRAY circle.

Name: redGrayCircle

Input Types: BOOLEAN, STRING, INTEGER

Output Type: HTML

Red/Gray Led

Converts the boolean value into a RED or GRAY led.

Name: redGrayLed

Input Types: BOOLEAN, STRING, INTEGER

Output Type: HTML

Yes/No

Converts the boolean value into a colored YES or NO text.

Name: yesNo

Input Types: BOOLEAN, STRING, INTEGER

Output Type: HTML

Yes/No Badge

Converts the boolean value into a colored YES or NO badge.

Name: yesNoBadge

Input Types: BOOLEAN, STRING, INTEGER

Output Type: HTML

Custom Variants

New variants can be defined through the following configuration options.

Option

Description

Sample Value

trueText

The text to be displayed when true (default null). If unspecified no text is displayed.

Yes

falseText

The text to be displayed when false (default null). If unspecified no text is displayed.

No

trueIcon

The Font Awesome icon to be displayed when true (default null). If unspecified no icon is displayed.

fas fa-circle

falseIcon

The Font Awesome icon to be displayed when false (default null). If unspecified no icon is displayed.

fas fa-square

trueColor

The color code to be used for text, icon or badge coloring when true (default #28A745).

#007F0E, green

falseColor

The color code to be used for text, icon or badge coloring when false (default #DC3545).

#FF0000, red

badge

The flag indicating whether to display a colored badge (default false).

true

led

The flag indicating whether to display a colored shadow under the icon (default false) to simulate a led light.

true


Example of defining a custom boolean filter variants into the Custom Filters component.


exports.fooBarBoolean = BooleanFormatter({ "trueText": "FOO", "falseText": "BAR"});