To_Numeric

To_Numeric Convert input value into numeric

Example 1:

Step 1: Create an empty to_numeric_example_1 using AIOps studio as shown in the below screenshot. 

Empty pipeline

Step 2: Add the following pipeline code/commands into the above-created pipeline as shown in the below screenshot:

You can copy the below code into your pipeline and execute that in your environment. ##### This pipeline creates disk size in bytes as a dataset row. Pipeline uses ##### dm function to_numeric to convert string data into numeric. Next uses ##### mathematical operation to convert bytes to GB and displays both bytes ##### and Gb to the output @dm:empty --> @dm:addrow disk_size_in_bytes = '10737418240' --> @dm:map attr = 'disk_size_in_bytes' & func = 'to_numeric' --> @dm:map from = 'disk_size_in_bytes' & to = 'disk_size_in_GB' & func = evaluate & expr = "disk_size_in_bytes/1024/1024/1024"

Pipeline code added to empty pipeline created

Step 3: Click verify button to make sure syntax and pipeline code is correct (as shown below)

Pipeline code is verified using 'Verify' button as shown above.

Step 4: Click execute button and execute the pipeline. RDA will execute the pipeline without any errors (as shown below)

Successful execution of pipeline without any errors

Step 5: RDA uses the dm function to_numeric to convert string data into numeric, which in turn is used to convert disk size that was in bytes to convert to GB as shown in the output. This function will be useful when the dataset contains strings that need to be converted to numeric and perform some mathematical logic similar to the above-explained example.

Successful execution of pipeline using dm function 'to_numeric' and prints output in Gb

Last updated