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

Dictionary rename to

This is actually non native complex block which pops value from source dictionary and stores target value into target dictionary with new key name. During transport value is unchanged.

In case source key value does not exists warning is generated. Unfortunately this event can be detected only at runtime.

Block XML representation

XML representation of function_dictionaries_rename_key block¶

<xml xmlns="http://www.w3.org/1999/xhtml">
  <block type="function_dictionaries_rename_key">
    <value name="FROM">
      <block type="dictionaries_get_index">
        <mutation statement="false" at="true"/>
        <value name="VALUE">
          <block type="variables_get">
            <field name="VAR">dictionary</field>
          </block>
        </value>
        <value name="AT">
          <block type="text">
            <field name="TEXT">foo</field>
          </block>
        </value>
      </block>
    </value>
    <value name="TO">
      <block type="dictionaries_get_index">
        <mutation statement="false" at="true"/>
        <value name="VALUE">
          <block type="variables_get">
            <field name="VAR">dictionary</field>
          </block>
        </value>
        <value name="AT">
          <block type="text">
            <field name="TEXT">bar</field>
          </block>
        </value>
      </block>
    </value>
  </block>
</xml>

Example of visual representation

Block "Rename to"

Block “Rename to”

Example 1 of block usage

Example of "Rename to" block

Example of “Rename to” block

Rename block is used for example for:

  • renaming of input data keys in JSON format, when keys are created in source message,
  • dictionary created from regular terms, where key names are created dynamically.

In both cases may be needed to adjust input keys to standard names.

In the example the block is used to rename key “ip” to a key “ip_address” in dictionary “item”.

Processed results

Result of the "Rename to" block

Result of the “Rename to” block

Example 2 of block usage

Example of "Rename to" block with "If" block

Example of “Rename to” block with “If” block

To avoid warnings use this block only in case when you are sure source key exists.

In this case it is solved by containing block int If statement. However in real case there would be better solutions to this.

Processed results

Result of the "Rename to" block with "If" block

Result of the “Rename to” block with “If” block