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

List create

This block is used to create variable with list data type. Output of the block is empty list of values.

This block is used to create a new list with defined elements. Option to insert more elements is under the “options” icon in the left part. Values are connected in the right part. Output of the block is a list with defined elements.

In case block has defined connection slots without assigned value None value is automatically generated into to fill empty connector to not break list indices. However this situation should be fixed.

Block XML representation

XML representation of lists_create_with block

<xml xmlns="http://www.w3.org/1999/xhtml">
  <block type="lists_create_with">
    <mutation items="0"/>
  </block>
  <block type="lists_create_with">
    <mutation items="3"/>
    <value name="ADD0">
      <block type="text">
        <field name="TEXT">val1</field>
      </block>
    </value>
    <value name="ADD1">
      <block type="variables_get">
        <field name="VAR">var2</field>
      </block>
    </value>
    <value name="ADD2">
      <block type="logic_null"/>
    </value>
  </block>
</xml>

Example visual representation

Block "Create list with"

Block “Create list with”

Example 1 of block usage

Example of "Create list with" block

Example of “Create list with” block

Block is used on the “set list to” row in the example:

  • New variable “list” of a list data type with “item1” and “item2” elements is created.
  • Value “item 3” is inserted to the first position in the list on the “in list” row.
  • Value “item_set” is inserted on the second position on the next “in list” row.

Output of this program is a list containing values = [“item3”, “item_set”, “item2”].

Processing result

Results of "Create list with" block

Results of “Create list with” block

Example 2 of block usage

Next example of “Create list with” block use consists in creation of names of input data keys. Values of all those keys gets IP address data type assigned.

Example of "Create list with" block

Example of “Create list with” block

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 "Create list with" block

Results of “Create list with” block