Integer create with
Block retypes input value (on right side) to integer representation on output side (left). In case when value can’t be retyped to integer uses integer value -1 as default value.
It is necessary to retype input string values to integers for integer operations with provided data while still in processing and also later when integers are required for data extraction from database for example for integer aggregations etc.
In case integer value is stored in database it is not directly stored under specified key name which always stores string representation, but special key name is created with value representation. Such key name is created as original_key@int. Therefore for accessing integer value retrieved from database integer key name has to be used.
XML representation of math_number_create block:
<xml xmlns="http://www.w3.org/1999/xhtml">
<block type="math_number_create">
<value name="VALUE">
<block type="text">
<field name="TEXT">1</field>
</block>
</value>
</block>
</xml>
This block is used for example in cases, where is the source data containing number, which is stored as text data type. Number stored in this way cannot be used e.g. for comparison with another number, as it is in the example of the block use.
Block is used on the “set user_length_as_number” row in the example:
- Value “username_minimal_length” is retrieved from the “item” dictionary. Value is a text string “6”. Output of the “Create number with” block is integer value “6”. This value is compared in the IF block with output of the “length of” block (value is “13”). Addition of the “long_username” tag to the message is the result.
{
"user": "administrator",
"username_minimal_length": "6",
"ip": "8.8.8.8"
}