Data Mapping cfxdm - dm:to_type
Set data type on columns
Last updated
Set data type on columns
Last updated
dm:to_type: It allows to change or set the data type to string or integer (numeric) or float for specified columns.
@param 'columns' (mandatory, comma separated list of column names), @param 'type' (mandatory, supported options are: str / int / float)
dm:to_type: Syntax
columns (mandatory): Comma-separated list of column names
type (mandatory): Supported options are: str (string or text) / int (integer or numeric) / float
Step 1: Create an empty dm_to_type_example_1 using AIOps studio as shown in the below screenshot
##### This pipeline creates a set of records/dateset details with different datatypes
##### String and integer.
###### This pipeline uses dm to_type to convert basic string data type to int datatype
--> @dm:empty
--> @dm:addrow id = 'a1' & x = '10.0' & y = '3.11' & z = 9
--> @dm:addrow id = 'a2' & x = '1.0' & y = '13.0' & z = 4
--> @dm:addrow id = 'a3' & x = '7.0' & y = '3.0' & z = 3
--> @dm:addrow id = 'a4' & x = '4.0' & y = '-1.4' & z = 9
--> @dm:to_type columns ='x,y' & type = 'int'
Step 3: Click verify button to verify the pipeline. RDA will verify the pipeline without any errors (as shown below)
Step 4: Click execute button to execute the pipeline. RDA will execute the pipeline without any errors (as shown below)
Step 5: Verify that the output data is enriched with the requested column names and print the output as shown in the below screenshot.
As shown in the above pipeline, this function is used to convert string to int (or float) datatype needed for any integer manipulation, etc.