Convert the acquired data to an integer value and output the results
This section describes how to convert the data acquired from the equipment to an integer value and output the result.
This process outputs results such as the following:
- Example
-
If the input value is a string type of "27", the output value becomes an integer type of "27".
Description of the processing
The data acquired from the equipment is converted to an integer type value and output.
In the following example, because the value that can be acquired in the monitoring file updates operation of the CSV adapter is a string type value, an error occurs when you draw a mapping link directly to the Add logic and execute the script. To avoid this error, convert the value that can be acquired in the monitoring file updates operation to an integer value and create a mapping definition to pass the converted value to the Add logic.
If the string type value that can be acquired in the monitoring file updates operation of the CSV adapter is a floating point value, use the Convert to floating point logic. Refer to Convert the acquired data to a floating point value and output the results .
Key features
- To Integer
-
This logic converts the input value to an integer value.
It can be set from Number > Basic > To Integer of the tool palette.
Operation procedure
This section describes an example on how to convert a string type value (the value that can be acquired in the monitoring file updates operation of the CSV adapter) to an integer value to enter the numerical value in the Add logic.
1. Create a script.
For information about how to create a script, refer to First Step Guide.
The descriptions in this procedure are based on the following scripts:
2. On the script canvas, double-click mapping_1.
The Mapper editor is displayed.
3. Create a mapping that requires an integer type input value.
The Add logic is placed in this example. For details on the Add logic, refer to Perform the four basic arithmetic operations for the acquired data and output the results.
4. From the tool palette, drag and drop Number > Basic > To Integer onto the Mapper editor.
The To Integer logic is placed in the Mapper editor.
5. If necessary, enter the property of the placed logic.
-
Double-click the To Integer logic.
The To Integer Logic Property dialog box is displayed.
-
Enter a comment in Comment and click Finish.
6. Drag and drop the input source node (or another logic) onto the To Integer logic.
The mapping link to the To Integer logic is displayed.
7. Drag and drop the To Integer logic onto the Add logic.
The mapping link from the To Integer logic to the Add logic is displayed.
8. Save the script.
For information about how to save a script, refer to First Step Guide.