Official | HULFT IoT EdgeStreaming Reverse Reference First Edition: July 1, 2021

Convert the acquired data to a character string and output the results

This section describes how to convert the data acquired from the equipment to a character string and output the result.

This process outputs results such as the following:

Example

If the input value is a floating point type of "27.1", the output value becomes a string type of "27.1".

Description of the processing

The data acquired from the equipment is converted to a string type value and output.

In the following example, because the CPU usage rate (percent_overall) that can be acquired in the Get OS resources operation is a floating point type value, an error occurs when you draw a mapping link directly to the Concatenate logic of the character string and execute the script.

To avoid this error, convert the value that can be acquired in the Get OS resources operation to a string type value and then create a mapping definition to pass the converted value to the Concatenate logic.

Key features

Convert to string

This logic converts the input to the string type.

It can be set from String > Basic > Convert to string of the tool palette.

Operation procedure

This section describes an example on how to convert a floating point type (the CPU usage rate that can be acquired in the Get OS resources operation) to a string type to enter the character string in the Concatenate 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 string type input value.

The Concatenate logic is placed in this example. For details on the Concatenate logic, refer to Concatenate the acquired data and output the results .

4. From the tool palette, drag and drop String > Basic > Convert to string onto the Mapper editor.

The Convert to string logic is placed in the Mapper editor.

5. If necessary, enter the property of the placed logic.

  1. Double-click the Convert to string logic.

    The Convert to string Logic Property dialog box is displayed.

  2. Enter a comment in Comment and click Finish.

6. Drag and drop the input source node (or another logic) onto the Convert to string logic.

The mapping link to the Convert to string logic is displayed.

7. Drag and drop the Convert to string logic onto the Concatenate logic.

The mapping link from the Convert to string logic onto the Concatenate logic is displayed.

8. Drag and drop the Concatenate logic onto the output destination (element_1 in this example).

The mapping link to the output destination from the Concatenate 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