Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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. 

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

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

View solution in original post

1 Reply
Anonymous
Not applicable
Author

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