Logmanager documentation
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Integer create with

This block retypes the input value (on right side) to an integer representation on the output side (left). In case the value can’t be retyped to integer, it uses the integer value -1 as the 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 an integer value is stored in a database, it is not directly stored under a specified key name, which always stores string representation, but a 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.

Block XML representation

<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>

Example of visual representation

Block "Create number with"

Block “Create number with”

Example of "Create number with" block

Example of “Create number with” block

Example of block usage

This block is used, for example, in cases, where the source data contains a number, which is stored as the 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 the output of the “length of” block (value is “13”). Addition of the “long_username” tag to the message is the result.

Input data

{
  "user": "administrator",
  "username_minimal_length": "6",
  "ip": "8.8.8.8"
}

Processing result

Results of "Create number with" block

Results of “Create number with” block