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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Subtracting a Date given in field minus one Day

Hi
I am used to using MySQL and was wondering if someone could help me and tell me how i would do this in Talend.
I have a mysqloutput table which has three variables and each variable is to calculate the date to be added in there using the value of the inputed date i have in my file delimited.
could someone help with how i would do the following.
the input table has these variables Audit _Date and in the output table i have Audit_Date,ref_Date,flu_com,flu_end .
i am using Tmap for other validations the values for the other variables in Mysql will be like this
UsingMySql i would do the following: could you please help me on how i would do it in Talend
ref_date = date_sub(Audit_Date, interval 1 day)// i am subtracting the current given date in the audit_date field with 1 day and when this calculation is done then the value is inserted for the ref_Date variable.
flu_com = date_format(concat((year(audit_log.Audit_Date) - 1),'0901')'%Y-%m-%d') this takes the year for the Audit_Date give and then joins it with 0901 being 09 is the month and 01 is the day, I want the value in flu_com to be the 01/09/of the previous year for that Audit_Date year
flu_end = date_format(concat((year(audit_log.Audit_Date),'0331')'%Y-%m-%d') this takes the year for the Audit_Date give and then joins it with 0331 being 03 is the month and 31 is the day, I want the value in flu_end to be the 31/03/of the year for that Audit_Date
example given below
Input ----> Output
Audit_Date Audit_Date Ref_Date flu_com flu_end
1997/03/31 1997/03/31 1997/03/30 1996/09/01 1997/03/31
1998/10/01 1998/10/01 1998/09/31 1997/09/01 1998/03/31

Many thanks
Labels (2)
1 Reply
Anonymous
Not applicable
Author

I had the same requirement. Talend folks gave me sugggestion, take a look here:
https://community.talend.com/t5/Design-and-Development/Subtract-specific-time-interval-from-a-given-...
It didn't work for me, however I didn't follow up on that as I my requirements had changed and I came up with different solution using dimensional modeling.
Peter.