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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Get day of the Week in Talend

Hi,
I need to populate the day of week (example : "Tue" for Tuesday into the database string data type column by using the tmap.
Can anyone please suggest me?
Thanks!
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Thank you Shong!
My problem resolved.
Var.var1==0?"SUN": (Var.var1==1?"MON": (Var.var1==2?"TUE": (Var.var1==3?"WED": (Var.var1==4?"THU": (Var.var1==5?"FRI":"SAT")))))

View solution in original post

8 Replies
Anonymous
Not applicable
Author

Hi
There is a built-in function TalendDate.getPartOfDate(String date_part, Date date) returns the part of date, includes DAY_OF_WEEK, this function returns an int data, so, you can call this function to get the part of week and convert it text string like this:
0683p000009MCkI.png
expression of var1:
TalendDate.getPartOfDate("DAY_OF_WEEK", row1.newColumn) 

expression of newColumn
Var.var1==0?"Sun": (Var.var1==1?"Mon": (Var.var1==2?"Tue": (Var.var1==3?"Wed": (Var.var1==4?"Thu": (Var.var1==5?"Fri":"Sat")))))


Hope this helps you.
Anonymous
Not applicable
Author

Hi Shong,
I did used the expression as provided by you and getting the error.
ORA-14400: inserted partition key does not map to any partition
Expressions used
TalendDate.getPartOfDate("DAY_OF_WEEK",msp_dly_copyright_file.WK_DAY)
Var.var1==0?"Sun": (Var.var1==1?"Mon": (Var.var1==2?"Tue": (Var.var1==3?"Wed": (Var.var1==4?"Thu": (Var.var1==5?"Fri":"Sat")))))
0683p000009MCly.png

0683p000009MCWC.png
Please correct me if I'm wrong.
Thanks,
Yugandhar
Anonymous
Not applicable
Author

Thank you Shong!
My problem resolved.
Var.var1==0?"SUN": (Var.var1==1?"MON": (Var.var1==2?"TUE": (Var.var1==3?"WED": (Var.var1==4?"THU": (Var.var1==5?"FRI":"SAT")))))
Anonymous
Not applicable
Author

Great! thanks for your feedback.
Anonymous
Not applicable
Author

Hi Shong,
I'm encountering one more problem while loading the WK_DAY into the target table.
From my source I'm not getting any date values.Only thing I need to do is whenever the job gets execute it should populate the day of the week into the column.
My problem is when I execute the job on Thu (Thursday) week day the table is getting popualted as "SUN" (Sunday)
Can you please correct me if anything is wrong.
TalendDate.getPartOfDate("DAY_OF_WEEK",row3.WK_DAY)
Var.var1==0?"SUN": (Var.var1==1?"MON": (Var.var1==2?"TUE": (Var.var1==3?"WED": (Var.var1==4?"THU": (Var.var1==5?"FRI":"SAT")))))
Talend screenshot
0683p000009MCm8.png
Database table screenshot
0683p000009MCmD.png

Thanks,
Yugandhar
Anonymous
Not applicable
Author

Hi
If the date does not come from the input data,  you can use TalendDate.getCurrentDate() to get the current date, so change the expression to:
TalendDate.getPartOfDate("DAY_OF_WEEK",TalendDate.getCurrentDate()) 
Anonymous
Not applicable
Author

Hi Shong,
I'm using the below expression in the talend tmap and getting the below error(cannot convert int  to string)
TalendDate.getPartOfDate("DAY_OF_WEEK",TalendDate.getCurrentDate())
Can you please let me know if anything is wrong

0683p000009MCkE.png

0683p000009MCmI.png
Thanks
Anonymous
Not applicable
Author

Thank Shong!
I did implemented the expression and it is working fine.
Please ignore the above message.
0683p000009MCmN.png