Official | HULFT IoT EdgeStreaming Reverse Reference First Edition: July 1, 2021
Convert the acquired data to a floating point value and output the results
This section describes how to convert the data acquired from the equipment to a floating point value and then output the result.
This process outputs results such as the following:
- Example
-
If the input value is a string type of "27.1", the output value becomes a floating point type of "27.1".
Description of the processing
This logic converts the data acquired from the equipment to a floating point value and then outputs the result.
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 a floating point 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 an integer value, use the To Integer logic. Refer to Convert the acquired data to an integer value and output the results.
Key features
- Convert to floating point
-
This logic converts the input value to a floating point value.
It can be set from Number > Basic > Convert to floating point 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 a floating point 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 a floating point 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 > Convert to floating point onto the Mapper editor.
The Convert to floating point logic is placed in the Mapper editor.
5. If necessary, enter the property of the placed logic.
-
Double-click the Convert to floating point logic.
The Convert to floating point 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 Convert to floating point logic.
The mapping link to the Convert to floating point logic is displayed.
7. Drag and drop the Convert to floating point logic onto the Add logic.
The mapping link from the Convert to floating point logic to the Add logic is displayed.
8. Drag and drop the Add logic onto the output destination (element_1 in this example).
The mapping link to the output destination from the Add logic is displayed.
9. Save the script.
For information about how to save a script, refer to First Step Guide.
Official | HULFT IoT EdgeStreaming Reverse Reference First Edition: July 1, 2021