Property Class
Property Class
The Property class allows you to manage global and local properties used in your scripts.
Static Properties
Property.global
: A static property that holds a global PropEnvironment for managing global properties.
Property.local
: A static property that holds a local PropEnvironment for managing local properties.
PropEnvironment Class
The PropEnvironment class is used for managing properties in a specific context, providing essential methods for property management.
Methods
set(propertyId: String, value: any): void
: Sets a property in the current environment for a specifiedpropertyId
and assigns it the provided value.
get(propertyId: String): any
: Retrieves the value of a property with the givenpropertyId
from the current environment.
inc(propertyId: String): Integer
: Increments the value of the property with the specifiedpropertyId
in the current environment and returns the new value as an Integer.
dec(propertyId: String): Integer
: Decrements the value of the property with the specifiedpropertyId
in the current environment and returns the new value as an Integer.
counter(propertyId: String): Integer
: Returns the current value of the property with the givenpropertyId
without modifying it.
Examples
Example: Set Global Property
Description: This script sets a global property that can be accessed across different iterations globally for the current execution.
Use Case: Useful for sharing data and settings across multiple nodes within your data processing.
Global Properties obtain their values at the initiation of the iteration. They are promptly evaluated and added so that any node within the workflow can access and utilize them.
Local Properties
Local Properties are defined per node using the 'add property' button under properties tab. They can only be read in the current iteration.
Example: Set Local Property
Description: This script sets a local property that can be read only within the current iteration.
Use Case: Valuable for temporarily storing and accessing data within a specific iteration.
These properties enable you to transmit and retrieve data, either globally or within the current iteration, as required.
Example: Max Value
The following script calculates the maximum value of an Integer column in a table and assigns it to a property named MAXVALUE. It sorts the table based on the sixth column in descending order and then retrieves the maximum value from the first row of that column. Here's the code snippet with comments:
This code is employed to extract and store the maximum value in a local property named MAXVALUE, which can then be utilized in subsequent scripting.