/>
Conditions

Dataname options for conditions

if

Can be applied to all types where comparisons are possible

With the if option you can make a choice between two options. The syntax for the if option is:

if:operator:value:option1:option2

 

Imagine you have just done a count on a list. Then the following if statement can be added.

if:more:5:"list is greater than 5":"list is less than 5"

 

if_break

Can be applied to all types where comparisons are possible

With if_break you can ensure that under certain conditions the formatting options are canceled and a value is returned immediately. There are two options here. The first option is to abort and return the current value. The dataname below shows the number from the field celcius@temperature. If the value is above 0, the value is shown immediately. If the value below 0 is the value is multiplies by -1:

celcius@temperature|if_break:more/equal:0|math:*- 1

The second option you have with if_break is to abort and return a fixed value. The example below gives first two lines of the description. If there is no description, the text "no description known" is shown:

description@content|if_break:text_is:"":"no description known"|format: twoliner

 

Possible comparison and operators

In the condition options for datanames mentioned above, operators are used. The same set of operators can be use for all condition options in datanames. The following options are possible as value for the operator:

 

Operators that you can apply to numbers:

  • more: checks whether the existing value is greater than the given value.
  • less: checks whether the existing value is smaller than the value given.
  • equal: checks whether the existing value equals the value given.
  • more/equal: checks whether the existing value is greater than or equal to the given value.
  • less/equal: checks whether the existing value is less than or equal to the given value.

 


Operators that you can apply to text:

  • text_is: checks whether the existing text is equal to the given value. Spaces, tabs and enters before or both of both the existing and the given value are hereby ignored.
  • text_not_is: checks whether the existing text is not equal to the given value. Spaces, tabs and enters before or both of both the existing and the given value are hereby ignored.

Contact us

Do you want to participate in the dataname project? Or do you want to implement datanames and looking for some help? Send us a message and we'll be teaming up!

Datanames are an essential part of the Webanizr project