Calc Process Object
An Integrator Calc process object can define new columns, or update existing columns, which are the results of calculations. This provides the ability to create new fields in Integrator. A calculation string provides the formula for the field. This formula is defined in a calculation syntax that is common to various DI products. Different calculation strings can refer to each other in the same PROC object, or in separate objects. However, references to a calculated field by another calculation uses the old value, not the new one, when the referenced calc has the attribute update = "true". Use an intermediate variable or a second Calc object for access to both the original and updated values.
Calc Attributes
| Attribute | Type | Description |
|---|---|---|
| process_type (required) |
String | Identifies the object as a Calc process object. The value of this string is "calc". |
| input (required) |
String | Defines the object from which the data flow is arriving. |
| calcs | Array of Sub-Objects | Defines new calculated columns. At least one calculation must be defined. See the table below (Calc Sub-Objects Attributes) for details. |
| calc_list_input | String |
Specifies a separate input flow used to define new calculated columns. This attribute allows
calculation definitions to be read from files, or defined in a List input object. This can be used to
share calculation definitions among several different Integrator scripts, or to allow users to add
calculated fields without editing the Integrator script itself. The required and optional columns
are listed below:
NOTE: This attribute is Calc List Input in Visual Integrator. |
| trace_after | Sub-object | Traces data flows leaving the specified object, which makes debugging scripts easier. This is equivalent to adding a Trace process object immediately after the current object. See Embedded Trace Object for more on using trace sub-objects. |
| trace_before | Sub-object | Traces data flows entering the specified object. This is equivalent to adding a Trace process object immediately before the current object. See Embedded Trace Object for more on using trace sub-objects. |
Calc Sub-Objects Attributes
(Defines new calculated columns. At least one calculation must be defined.)
| Attribute | Type | Description |
|---|---|---|
| name | String | Names the column that is being defined. Column names should begin with a letter, not a number. Column names are case insensitive. Older scripts may use the column attribute. |
| value | String | Defines the calculation string used to create the new column. Older scripts may use the calc_str attribute. |
| column | String | Names the column that is being defined. Same as name. |
| calc_str | String | Defines the calculation string to create the new column. Same as value. NOTE: Either name or column can be used to name a column. Likewise, either value or calc_str can be used to give its definition. However, the name and value attributes are compatible with calculation definitions within DI Builder and if used, facilitate copying and pasting between Integrator scripts and Builder Descriptions files. Therefore, use of the name and value attributes is recommended. |
| persistent | Boolean |
Allows calculations to be based on data contained in previous rows. If this attribute value
is set to "true", the given calculation is persistent. A persistent calculated field retains its
value across rows. NOTE: This attribute is Persist in Visual Integrator. |
| initial_value | String |
Defines the initial value of a persistent calculated field. This value is used as the calculated field value for the first input row. If this attribute does not exist, the initial value defaults to the empty string(""). To refer to the post-calculation value of a persistent calc, do it in a later Calc object. NOTE: This attribute is Initial Value in Visual Integrator. |
| update | Boolean | Allows the calculated column to update the value of an existing column. Values include:
Referring to an updated calc within the same Calc object will get the pre-updated value when update = "true". |