Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to get start date for new record and set end date for previous record

Hi All,

 

I am implementating SCD type2 without using SCD component in talend but i am not getting Startdate and End as par my requirement.

Requirement is:

1.If data is fresh then start date will set as current date and end date as null.

2.if data is already exist in DB but one attribute changed that data then what it should do for previous record end date should be as current date and for new updated record start date as current date and end date will be null.0683p000009LtGk.png0683p000009LtOm.png0683p000009LtOr.png0683p000009LtH6.png

Please Tell me where m going wrong.

 

Thanks,
Arpit

Here my screenshots:

Labels (2)
20 Replies
Anonymous
Not applicable
Author

You shouldn't need 2 subjobs. Why not just have 1 subjob with your new data feeding your tMap as Main and your existing data (in the scd) as your lookup. Join on whatever key you use. When there is a join, you need to update your existing record (use an output to update this record setting the end date as the date of the new record. You also have an output for your new record (where you will set the start date as the same date as the end date of the updated record). If there is no join, you only send the new record. 

 

Anonymous
Not applicable
Author

Hi @rhall

 

Thanks for your response, I go through the your previous comment and implement but i am getting Variable error.

Below is snapshot:

0683p000009Lszz.png

Anonymous
Not applicable
Author

Hi @shong please take a look at this.

Anonymous
Not applicable
Author

Can you click on the Code tab (in the bottom left corner of your workspace window), then look for red rectangles and click on them to see the code in error. Give us a few examples of the errors.

Anonymous
Not applicable
Author

please take look at this on error.

0683p000009Lt3z.png

Anonymous
Not applicable
Author

0683p000009Lsym.png
Now getting this error.

Anonymous
Not applicable
Author

Hera are all details:

0683p000009LtHD.png0683p000009LtJT.png0683p000009LtNZ.png

 

Please tell me if i am using wrong expression as well and putting condition in expression builder box for update and old record.

 

Thanks,

Arpit

Anonymous
Not applicable
Author

ok i am fix the variable problem but now job looks like stuck cause condition and expression.

can anyone have look on this:

0683p000009LtNe.png0683p000009LtCL.png

 

Thanks,

Arpit

Anonymous
Not applicable
Author

these are snapshots for insert, update and old dim_table, check if action on data option:

0683p000009LtOD.png0683p000009LtNf.png0683p000009LtON.png