Work with attributes globally

After it is defined, you can get and set message attributes values using calls to built-in functions.

A family of built-in functions exists to read attributes. Since you might require a specific class for the result, there exist four functions in this family: one for each class (getBooleanAttribute, getIntegerAttribute, getRealAttribute and getStringAttribute). You pass the names of the attribute and its field as arguments to one of these functions. You must use these function in connection with the type defined for the attribute field in the .s4h file. For example, type STRING requires the use of getStringAttribute.

To set an attribute value you use calls to setAttribute with the appropriate arguments (attribute name, field name and value).

The key point to remember in reading and setting attributes is that they are attached to the Activity messages, and not to the Business Document instances that are moved across the Mapping Flow.

 Mapping Flow that manages a single message with multiple instances of a Business Document inside

As a consequence, all output messages share the same attributes. In a complex Mapping Flow, the actual value of the attribute is the result of the last call to setAttribute.

Attributes are usually not transferred automatically across Mapping Flows. You explicitly call the appropriate get and set functions to copy their value from input messages to output messages.

Related Links