Featured Post

Applying Email Validation to a JavaFX TextField Using Binding

This example uses the same controller as in a previous post but adds a use case to support email validation.  A Commons Validator object is ...

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.

9 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
  3. how to convert Bigdecimal to integer in talend????

    ReplyDelete
  4. Use the Bigdecimal's method intValueExact()

    ReplyDelete
  5. without tconverter how to change the datatype in talend

    ReplyDelete
  6. without tconverter how to change the datatype in talend

    ReplyDelete
    Replies
    1. Use a tMap or tJavaRow, putting a Java expression in for the conversion.

      Good luck

      Delete