VI Calc Process Object
The Visual Integrator (VI) Calc process object defines new columns or updates existing columns with the results of calculations and passes the results into the data flow.
A calculation string provides the formula for the column. This formula is defined using Integrator calculation syntax. You can have multiple calculations in one Calc object.
These calculation strings can refer to each other in the same Calc object. However, references to a calculated column by another calculation use the original value, not the new one if the referenced calculation has the Update attribute set to True. Use a separate Calc object for access to both the original and updated values.
The Calc process object has five panes where you set attributes.
You set attributes for the Calc object in the object attributes pane.
Attribute | Description |
---|---|
Input |
Defines the object from which the data flow arrives. Use one of the following methods to attach the Calc object to an input data flow object:
|
Calc_List_Input |
Specifies a separate input flow object that is used to define new calculated columns. You can have the calculation definitions read from files or define them in a List input object. For more information, see VI List Input Object. By using the Calc_List_Input attribute, you can share calculation definitions among VI scripts and allow users to add calculated columns without the need to edit the VI script. Required and optional columns for files referenced by the Calc_List_Input are:
To populate the Calc_List_Input attribute:
|
Each object has an area where you can enter comments.
It is a DI best practice to enter a note for every object in a VI script. You can set a VI preference to give a warning for each object without a note.
The defined calculations allow you to create new data columns in the data flow.
The general form of these calculations is: function(arg, arg, ...), where the arguments can be column names, variables (parameters), or constants.
There are two methods for completing calculation definitions: type the string directly into the definition panel, or pick functions and columns from the column grid and functions panel.
- Click in a row in the Name column, and specify a name for the calculation.
- Click the Definition panel.
- Enter the calculation expression in the form of: function(arg, arg, ...).
- For each calculation definition, set the Initial Value and the Persist and Update flags as required.
NOTE:
- You can use the Ctrl+Space shortcut as you type in the definition to get a pop-up pick list of functions to choose from. Enter the first few characters of the function, select the desired function with the arrow keys or mouse pointer, and then press Enter or double-click the function.
- Color coding in the Definition pane visually displays the command syntax elements: blue for function names, black for operators, and green for column names.
- As you enter elements in the Definition pane, tooltips appear that give a brief description of syntax. You can turn these tooltips off in the VI preferences. For more information, see Visual Integrator Preferences.
-
Click in a row in the Name column, and specify a name for the calculation.
-
Double-click a function from the Functions pane. For example; concat(,).
That function is added to the calculation definition in the Definition pane.
-
With the focus still in place within the concat(,) function, double-click an input column from the Input Column column in the column grid. For example, Customer Name.
That column is added to the Definition pane.
-
Enter an open bracket in quotes followed by a comma ("[",).
-
Double-click the next column you want to concatenate. For example, Customer ID.
-
Enter a comma and closed bracket in quotes (, "]") to complete the calculation.
The second column is added to the Definition pane.
NOTE: The Value column updates automatically to reflect each change made in the definition pane. In this example, after Customer ID is added to the definition, it appears in the Value column.
TIP: To delete multiple rows, you can multi-select calc rows by holding CTRL and clicking with the right mouse button; select the Delete line in the context menu after the last selection.
The Calc column grid displays the input data flow.
Attribute | Description |
---|---|
Input Column |
Displays the name of each input column. This attribute is read-only. Double-click a column to place that column into the active calculation definition at the cursor location. |
Source Object |
Displays the name and object type of the source object. Double-click the Source Object for a column to change the task flow focus to that object. |
You can choose functions to insert in the calculation definition from the Calc Functions pane.
The functions are listed in logical, string, and miscellaneous categories by default.
NOTE: To list functions alphabetically without the categories, you can change a preference. See Visual Integrator Preferences, and set the Sort calc functions by category preference to False.
Double-click the function to enter it into the Definition pane.
See also: