The Data Calculator component window provides tabular and graphic views of the data stream. You can also use this window to map port attributes and define transformation rules.
The tabular view provides a structural view of the current record structure, port attributes, and transformation rules. It includes:
The Current Input Record pane identifies each attribute and attribute value in the current record at the IN-port. All IN-port attributes include an IN. prefix.
The Transformation rules and Current Output Record pane includes a column and row for each transformation rule, and columns and rows for each OUT-port attribute. Default transformation rules map each IN-port attribute to a corresponding OUT-port attribute. OUT-port values reflect IN-port values by default. Changing the attribute value or transformation rule changes the OUT-port values.
If the transformation rule is a functional expression, you must enter it in a single line. The returned value is by default assigned to the corresponding OUT-port attribute. However, if you enter a multiline functional expression, the text is interpreted as a script, and you need to set the OUT-port attribute value.
The Input Port Content area shows the current set of records available at the IN-port.
The Output Port Content area shows the current set of records available at the OUT-port.
The graph view shows the current mapping between the IN-port and OUT-port attributes.
The Input Port Content area shows the current set of records available at the IN-port.
The Output Port Content area shows the current set of records available at the OUT-port.
After you apply a transformation rule to an IN.attribute, the mapping line between the IN.attribute and the OUT.attribute no longer appears.
Although Data Calculator creates column to column mapping between the IN-port and OUT-port as a default option, there may be times when you want to map port attributes individually. To create your own mappings, use the graphic view.
On the Data Calculator component window, click the Graph tab.
Map the IN-port and Out-port structures in one of these ways:
Select Mapping in the menu bar, and select one of these predefined mapping sequences:
Create mapping by Order – maps the port attributes of the IN- structures and OUT- structures sequentially.
If the number of attributes is different on both sides, some of the port attributes are not mapped.
Create mapping by Name – maps the port attributes of the IN-structures and OUT- structures according to their names.
Create mapping by Name Case Sensitive – maps the port attributes of the IN- structures and OUT- structures according to their case sensitive names.
Create mapping by prefix – maps the port attributes of the IN-structures and OUT- structures by name, ignoring the specified prefixes.
Create mapping by Best Match – maps the port attributes of the IN- structures and OUT- structures that sound alike.
Connect the IN-port and OUT-port attributes individually.
The component is now ready to be used and can forward records from the IN-port to the OUT-port.
One of the essential features of Data Calculator is the capability to display the result of transformation rules immediately. This simulation capability allows you to verify incoming data, test transformation rules, and view the effect of the rules on data output.
By default, output port values reflect Input port values. Changing an Input port attribute value lets you test transformation rules, and to see the results in the current output record. Manual modifications made in this area affect only the data of the Input or Output port buffer. This offers a convenient way to create test cases for transformation rules.
In the Transformation Rule column, you can add, modify, or delete transformation rules. You can also edit single-line functions by changing the current attribute input field. Adding the function uUpper to the attribute IN.PR_NAME looks like the following example:
You can use the Procedure Editor. See “Using the JavaScript Editor and Debugger” for information about creating complex procedural transformations.
You can also add transformation rules. This is extremely helpful if the number of OUT attributes does not match the number of IN attributes, or if you add additional attributes to the project at a later stage of development.
The graphic view mirrors the actual port structures. You cannot add or delete attributes there.
To add a transformation rule, right-click anywhere on the Transformation Rule or Current Output Port column.
Select Insert.
You can now use the added rules for further assignments or calculations
To delete a transformation rule, right-click a row in the Transformation Rule column, and select Remove.
To change the order of the transformation rules, right-click the row in the Transformation Rule column, and select Up or Down.
To add missing output attributes, click Mapping, and select Add missing output attributes.
Transformation rules are processed in sequential order. The processing starts with the first transformation rule of the list. Consider the following example:
Line 9 looks up the number of zip codes for the city and stores the result in CitySize. The procedure in Line 10 calculates the CitySize string based on the CitySize number.
Data Calculator is designed so you can see the changes applied to data as it moves through the transformation rules. You may find this useful, for example to see how changing a transformation rule affects the outgoing data. Depending on status of the Auto-Synchronization button, a transformation rule is immediately applied to the entire set of IN-port records after the rule is entered.
Toggling auto synchronization:
Autosynchronization immediately applies all changes to the transformation rules to the current set of records at the IN-port.
If Auto-Synchronization is disabled, you can manually trigger the processing of the IN-port data by selecting the Step option.
Manually apply all transformation rules:
To manually apply all transformation rules to all current records at the IN-port, click the Step icon on the toolbar.
Fetching another set of records:
To fetch another set of records, click the Step through the next incoming data buffer icon on the toolbar.
Stepping through input port records:
To step through records at the IN-port:
Click the appropriate record control on the toolbar.
Click Navigate and select the appropriate option.
Select a record from the Input Port Content list.
The values shown on the Current Input Record area are updated as you change the current record.
Search for keywords in the transformation rules:
Click Search the Content of Transformation Rules icon on the toolbar.
Highlight null and empty values
Click Highlight NULL-Values and Empty Values icon on the toolbar.