Logmanager dokumentace
Přepnout tmavý/světlý/automatický režim Přepnout tmavý/světlý/automatický režim Přepnout tmavý/světlý/automatický režim Zpět na domovskou stránku

Controls For each item in

This section is available only in English

Block is used to iterate over input variable and each of variable element is placed into temporary variable during given iteration.

Input variable must be iterable. For example list, dict… Even strings are iterable however in this case iteration is performed on each letter in string variable.

Block XML representation

XML representation of controls_for_each block

<xml xmlns="http://www.w3.org/1999/xhtml">
  <block type="controls_for_each">
    <field name="VAR">item</field>
    <value name="LIST">
      <block type="variables_get">
        <field name="VAR">variable</field>
      </block>
    </value>
  </block>
</xml>

Example of visual representation

Block "For each item in"

Block “For each item in”

Example of block usage

Example of "For each item in" block

Example of “For each item in” block

Most common use of the block is shown in the example. For cycle checks “dst_ip”, “src_ip” and “remote_ip” keys, and if the key is found in the “item” dictionary, block “retype” performs retyping to the IP address data type.

Input data

{
  "src_ip": "192.168.1.5",
  "dst_ip": "8.8.8.8",
  "remote_ip": "1.2.3.4",
  "username": "administrator"
}

Processing result

Results of "For each item in" block

Results of “For each item in” block