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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

extract year from date type variable

Hello,
I m using TOS3.10 / java under windows xp and I wonder how I can extract the year part of a date or datatime type?
I will use it in an expression filter of a Tmap. From several tables i want to make a join but not all rows of the input table are suitable for the join.
Can someone help me, since i do not know anything of java.
Michel
Labels (3)
13 Replies
Anonymous
Not applicable
Author

Hi,
My requirement is:
I have a huge csv file and i would like to generate multiple files for each year(Only based on year) and these files  has to save into their respective year folders automatically. I have a date column. 
it is very urgent. Plz help me on this.
kind regards,
Asha
Anonymous
Not applicable
Author

org.talend.designer.hdfsbrowse.exceptions.HadoopServerException: org.talend.designer.hdfsbrowse.exceptions.HadoopServerException: java.util.concurrent.ExecutionException: java.lang.reflect.InvocationTargetException
            at org.talend.designer.hdfsbrowse.hadoop.service.check.AbstractCheckedServiceProvider.checkService(AbstractCheckedServiceProvider.java:51)
            at org.talend.designer.hdfsbrowse.hadoop.service.HadoopServiceBean.check(HadoopServiceBean.java:102)
            at org.talend.designer.hdfsbrowse.hadoop.service.check.CheckHadoopServicesDialog$5.run(CheckHadoopServicesDialog.java:373)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
     &n

To see the whole post, download it here
OriginalPost.pdf
Franz3
Contributor III
Contributor III

Lol i can't say for the error just ahead but for the date you have several options.
The easiest way is to open n times your file, not very efficient bur pretty simple
1)you get all the years, uniq those years, then you iterate (tflowtoiterate)
At this point you have an iteration for each different year in your csv
2) you put the year in a variable, then you reopen your file and filter on the year you need, and when you write on your files, you just have to put your variable in the file path. 
could be something like

tFileInputDelimited
tUniqRow
tFlowToIterate
tFileInputDelimited
tFilterRow
tFileOutputDelimited
Anonymous
Not applicable
Author

Hi guys, 
Need your help on getting the year only of a date field, i tried using this  TalendDate.formatDate("yyyy",rowX.myDate)
but I am having an error below " The cell format is not Date in ( Row. 1 and ColumnNum. 2 ) "

can you help me ?