Wednesday, 8 January 2014

Converting Types in tMap Component - Tips & Tricks

Checking whether the field is having null values or not. If it is null value print the NULL(nothing) , if it is NOT null then convert the type and display the filed in the output(output could be any database output table).
 
1) String to Integer
  Relational.ISNULL(row1.EmployeeID) == true ? null:Integer.parseInt(row1.EmployeeID)



2) String to Double
Relational.ISNULL(row1.Revenue)==true? null:Double.parseDouble(row1.Revenue)


3) String to Long
Relational.ISNULL(row1.Category_ID) == true ? null:Long.parseLong(row1.Category_ID)

4) String to Date
Relational.ISNULL(row1.Date)==true?
null:new SimpleDateFormat ("EEE mm/DD/yyyy").parse(row1.Date)   


5) Integer to Double
Relational.ISNULL(row1.NumberOfEmployees)==true? null:Double.parseDouble(Integer.toString(row1.NumberOfEmployees)) 
 
6) Integer to String

(Integer.toString(row1.id)).equals(Integer.toString(row2.id))
((new Integer(row1.id)).toString()).equals((new Integer(row2.id)).toString())==false



This post will be up-datable one.