Saturday, February 5, 2011

[TUTORIAL] Converting Data Types with Talend Open Studio

Use tConvertType's Auto Cast to convert a batch of String fields to a more restrictive data type like Long.

4 comments:

  1. Can i use tConvertType to convert Time to String??

    ReplyDelete
    Replies
    1. Hi,

      Use a tMap with the Routine TalendDate.formatDate (String->Date) or Talenddate.parseDate (Date->String).

      For example, add this to a target field in a tMap

      TalendDate.formatDate("yyyy-MM-dd HH:mm:ss",row1.today_d )

      tConvertType is used for conversions between String, Double, Float, Long, Short, and Integer.

      Delete
    2. I manage to convert time to string (with tConvert)and back to time (in tMap)with this other row: Talenddate.parseDate("HH:mm:ss",row1.today_d)
      Thanks for replying :)

      Delete
  2. Thanks, nice post :-)

    Unfortunately I found a bug in tConvertType - https://jira.talendforge.org/browse/TDI-27516

    The tConvertType is unable to convert a string like "4,096" to an integer. When piping "Row, Rejects" to a .csv file I get errors like:

    "Memory:For input string: "4,096";Provisioned_MB:For input string: "55,297"

    ReplyDelete