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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
desanip
Contributor
Contributor

Parse Date with default value "01-01-1000"

Hello talendians,

 

I want to pass a default value of "01-01-1000" to a column. The data pattern for the column is required to be " EEE MMM dd hh:mm:ss zzz yyy" and is also the same in all downstream components. Can you tell me how to write an expression in tmap? 

i tried using TalendDate.parseDate("yyyy-MM-dd","1000-01-01") but it didn't work. Can you please help me on this?

 

 

 

 

Labels (7)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Need to track and check where the error occurs, I don't think this expression throws the error. Any other place where you use the data ""01-01-1000"? Would you mind exporting the job and send it to me via email? I want to take a look at your full job.

Regards
Shong

View solution in original post

7 Replies
Anonymous
Not applicable

Hi
What's the error you have if using expression TalendDate.parseDate("yyyy-MM-dd","1000-01-01") to convert a string to a Date?

Regards
Shong
desanip
Contributor
Contributor
Author

The column need to always have the constant value of 1000-01-01. The column is of type date with pattern "EEE MMM dd hh:mm:ss:zzz yyyy". I am then passing this as input to txmlmap. I am seeing the following error:

 

Also attached a screenshot below. Please advice how to proceed. Thanks in advance.

-----------------------------

 

| label | ODateFormat[objectConverters=null, stringConverters=null]conversion error while handling input string '01-01-1000' |
| description | com.onwbp.adaptation.UowErrorWithUserMessage: The current value [01-01-1000] is not compatible with the type of the current node [/root/reference/productManagement/sourceLineItemXref/businessEffectivePeriod/businessEffectiveFrom].
at com.orchestranetworks.service.OperationException.createError(OperationException.java:3)
at com.onwbp.adaptation.ximport.g.endCurrentElement(g.java:40)

 

------------------------------------------


error.PNG
error2.PNG
Anonymous
Not applicable

I see you are using expression TalendDate.parseDate("yyyy-MM-dd HH:mm:ss","1000-01-01"), the pattern is not right for the date without time, change it to:
TalendDate.parseDate("MM-dd-yyyy","01-01-1000")
BTW, please insert images into your post body instead of attaching them.

Regards
Shong
desanip
Contributor
Contributor
Author

I have used TalendDate.parseDate("MM-dd-yyyy","01-01-1000") within my tmap like you suggested and it still throws the same error. I just want to reiterate that i am using data pattern "EEE MMM dd hh:mm:ss:zzz yyyy" everywhere for the column. 

 

0683p000009M9VA.png0683p000009M9VF.png

desanip
Contributor
Contributor
Author

@shong Any idea on this?

Anonymous
Not applicable

Need to track and check where the error occurs, I don't think this expression throws the error. Any other place where you use the data ""01-01-1000"? Would you mind exporting the job and send it to me via email? I want to take a look at your full job.

Regards
Shong
desanip
Contributor
Contributor
Author

Hi shong, I was able to resolve it fairly quickly. I used the following and it worked.

TalendDate.parseDate("yyyy-MM-dd","1000-01-01")