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

Length of

Block returns length of iterable sequence.

  • string - returns length of string (number of characters)
  • list - returns amount of elements in list
  • dict - amount of keys in dict

If input value is not iterable returns -1 as it’s length.

Block XML representation

XML representation of function_length block

<xml xmlns="http://www.w3.org/1999/xhtml">
  <block type="function_length">
    <value name="VALUE">
      <block type="text">
        <field name="TEXT">Value</field>
      </block>
    </value>
  </block>
</xml>

Example of visual representation

Block "Length of"

Block “Length of”

Example of block usage

Example of "Length of" block

Example of “Length of” block

This block is used three times in the example:

  • “set status_length” row: gets number of characters from variable “status”. Result is value “6”.
  • “user_length” row: gets number of characters from “user” key in “item” dictionary. Result is value “13”.
  • “if length of” row: gets number of characters from “user” key in “item” dictionary and if the value is greater or equal to “6”, user tag “long_username” is created.

Processing result

Results of "Length o" block

Results of “Length o” block