Tutorial Gateway

  • C
  • C#
  • Python
  • SQL
  • Java
  • JS
  • BI Tools
    • Informatica
    • Talend
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • R Tutorial
    • Alteryx
    • QlikView
  • More
    • C Programs
    • C++ Programs
    • Go Programs
    • Python Programs
    • Java Programs
  • MySQL

Talend tMap Type Conversion

This article shows how to use the Talend tMap to perform type conversion or change data types. We can use this Talend tMap as an alternative to tConvertType to change the column’s data type based on the requirement. In real-time, we mostly get the data in string format so, we have to change them to an integer, double, date, etc. 

To demonstrate the Talend tMap Type Conversion, we use the Customer_text text file that we used in the tConvertType example. So, let me use the tFileInputDelimited and choose the text file from the file system.

Talend tMap Type Conversion 1

Click on the Edit Schema button to add all the columns with data types. Or, if you have the existing metadata, please use the same. Anyways, you can see all the columns are of string type.

Talend tMap Type Conversion 2

Drag and drop the Talend tMap, and connect the tFileInputDelimited Main row to tMap.

Talend tMap Type Conversion 3

Double-click on the tMap opens the below window. Please click on the + button to add new output. Let me add all the columns from row1 to Type_Conversion_Out (the name we gave to this output).

Talend tMap Type Conversion 4

Our scenario is that we have a predefined table to store these records. And the table has EmpID of integer type, Income of Double, Sales as float type, and HireDate as the Date format. So, to meet the same, we changed the data type of the above-specified columns to the same.

Talend tMap Type Conversion 5

Let me run this Talend tMap Type Conversion job and see what will happen.

Talend tMap Type Conversion 6

As you can see from the above tMap image, it is throwing an error (type mismatch).

Talend tMap Type Conversion Steps

Please click on the browse button beside the EmpID will open the expression builder to write an expression. Please use this expression builder or perform typecasting or Conversion.

Talend tMap Type Conversion 7

For this column, we have to change the string type to integer. So, we are using the parseInt method. If you find it challenging to write a function, press the control + space to see the possibilities. Or, under Categories, you can find all the built-in functions.

Talend tMap Type Conversion 8

Click the Ok button to close the window.

Talend tMap Type Conversion 9

Similarly, we use parseDouble to convert string to double, parseFloat to convert string to float, and parseDate to convert a string value to date. Remember, for parseDate, please match the column pattern to the date format.

Talend tMap Type Conversion 10

For the time saving, we used the tLogRow to display the result. From the below image, you can see the Talend tMap Type Conversion result.

Talend tMap Type Conversion 11

Filed Under: Talend

  • Talend Download and Install
  • Create a Talend Business Model
  • Create a Talend Job
  • Create a Global Context Group
  • Connect Talend to SQL Server
  • Context Group to connect DB
  • Talend Read Text File
  • Talend Read Excel File
  • Load Text File Data into Database
  • Load Excel Data into Database
  • Export Database Table to Excel
  • Export Database Table to TextFile
  • Export Database Table to XML
  • Export Database Table to JSON
  • Talend Aggregate Row
  • Talend Aggregate Sorted Row
  • Talend Buffer Input & Output
  • Talend Create Table
  • Talend tDenormalize
  • Talend Datatype Conversion
  • Talend tMap Type Conversion
  • Talend Filter Columns
  • Talend Filter Rows
  • Talend tMap filter rows
  • Talend tFileList
  • Talend tFixedFlowInput
  • Talend tForeach
  • Talend Fuzzy Matching
  • Talend Joins
  • Talend tMap Joins
  • Talend tMap Join Lookup
  • Talend tJava
  • Talend tJavaRow
  • Talend tJavaFlex
  • Talend tLoop
  • Talend tMsgBox
  • Talend tNormalize
  • Talend Pivot Columns
  • Talend Replace Data
  • Talend Replicate
  • Talend tRowGenerator
  • Talend tRunJob
  • Talend Rejected Rows
  • Talend Sample Row
  • Talend Sort Row Data
  • Talend SCD
  • Talend SCD Type 2 Manual
  • Talend Unite
  • Talend Unique Row
  • Talend Read Multi-Structure File
  • Talend Parent Child Job
  • Talend Execute SQL Queries

Copyright © 2021· All Rights Reserved by Suresh.
About | Contact | Privacy Policy