Four Stars

Pass context variable in tMap

I have a job, where I have set a context variable named as "BusinessDate" of Type String, Value: 31-MAY-2017. I need to use this variable to set one of the columns in a table. 

My job is InputDelimited --> tMap --> Oracle load

In tMap, I am creating a new column MAT_DT of type Date & setting the value as "+context.BusinessDate+", but the job is throwing a error " Type mismatch: cannot convert from String to Date". If I use the function 'TalendDate.parsedate("DD-MMM-YYYY", "context.BusinessDate")', still its failing. How do I convert the context variable which is set as String to Date in tMap. 

  • Data Integration
Ten Stars

Re: Pass context variable in tMap

It sounds like you were nearly there with.....

TalendDate.parsedate("DD-MMM-YYYY", "context.BusinessDate")

The problem you have is that you have is that you are actually supplying context.BusinessDate as a literal String. Try the code below.....

TalendDate.parseDate("dd-MMM-yyyy", context.BusinessDate)

Also beware of using the incorrect case (upper or lower) for the format and the method call. I have changed yours to what I believe it should be

Rilhia Solutions