0 / 0
Structured properties

Structured properties

There are two ways in which scripting uses structured properties for increased clarity when parsing:

  • To give structure to the names of properties for complex nodes, such as Type, Filter, or Balance nodes.
  • To provide a format for specifying multiple properties at once.

Structuring for complex interfaces

The scripts for nodes with tables and other complex interfaces (for example, the Type, Filter, and Balance nodes) must follow a particular structure to parse correctly. These properties need a name that's more complex than the name for a single identifier; this name is called the key. For example, within a Filter node, each available field (on its upstream side) is switched on or off. To refer to this information, the Filter node stores one item of information per field (whether each field is true or false). This property may have (or be given) the value True or False. Suppose that a Filter node named mynode has (on its upstream side) a field called Age. To switch this to off, set the property include, with the key Age, to the value False, as follows:

mynode.setKeyedPropertyValue("include", "Age", False)

Structuring to set multiple properties

For many nodes, you can assign more than one node or flow property at a time. This is referred to as the multiset command or set block.

In some cases, a structured property can be quite complex. For example:

sortnode.setPropertyValue("keys", [["K", "Descending"], ["Age", "Ascending"], ["Na", "Descending"]])

Another advantage that structured properties have is their ability to set several properties on a node before the node is stable. By default, a multiset sets all properties in the block before taking any action based on an individual property setting.

Generative AI search and answer
These answers are generated by a large language model in watsonx.ai based on content from the product documentation. Learn more