To_Numeric
Last updated
Last updated
To_Numeric Convert input value into numeric
Step 1: Create an empty to_numeric_example_1 using AIOps studio as shown in the below screenshot.
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"
Step 3: Click verify button to make sure syntax and pipeline code is correct (as shown below)
Step 4: Click execute button and execute the pipeline. RDA will execute the pipeline without any errors (as shown below)
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.