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

Announcements
Only at Qlik Connect! Guest keynote Jesse Cole shares his secrets for daring to be different. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Shinigaloo
Contributor III
Contributor III

ERROR while cast object into string

Hello guys,

I have a problem in my job here is it : 

0683p000009M81x.png

I would like to loop a datetime variable and display it with a tjava

here is my tflowtoiterate component : 

0683p000009M7fH.png

 

but in my tjava component when i try to display my datetime variable it's ot working it's say object can not be convert into string 

 

here my tjava component :

0683p000009M7fg.png

 

any help please to convert this variable into datetime or string 

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable

I suspect that you want something more like this.....

context.datetime=TalendDate.formatDate("yyyy-MM-dd HH:mm:ss.SSS",((Date)globalMap.get("last_datetime")));
System.out.println("Value Of Input:"+context.datetime);

This may need some tweaking as I was copying from your screenshot. It always helps to include code as text so that it can be copied and pasted when needing editing.

View solution in original post

3 Replies
Anonymous
Not applicable

It looks like the value of "Last_datetime" is maybe not a String. Is it is a Date object? Also, it looks like the key should be "last_datetime" and not "Last_datetime". Can you identify the data type of the column that supplies that value?

Shinigaloo
Contributor III
Contributor III
Author

yes here is my source : 

 

0683p000009M7wF.png

my column is last_datetime it's a datetime type and in my tmssqlinput here is the schema :

 

0683p000009M7b1.png

thx you for your answer.

Anonymous
Not applicable

I suspect that you want something more like this.....

context.datetime=TalendDate.formatDate("yyyy-MM-dd HH:mm:ss.SSS",((Date)globalMap.get("last_datetime")));
System.out.println("Value Of Input:"+context.datetime);

This may need some tweaking as I was copying from your screenshot. It always helps to include code as text so that it can be copied and pasted when needing editing.