Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
i am working on incremental load for insert and update.
the requirement is we need the record for the newly added records.
Test:
LOAD wp_name,
descr,
erp_ord_no,
art_no,
art_descr,
ok_cnt,
nio_cnt,
err_descr,
cnt,
na_cnt,
shift_no,
shift_start,
shift_end,
inserted_date
FROM
(qvd);
//max inserted date
Test1:
LOAD max(inserted_date) as max_date
Resident Test;
//variable
LET vupdateddate = Peek('max_date',0,'Test1');
DROP Table Test;
Test2:
LOAD wp_name,
descr,
erp_ord_no,
art_no,
art_descr,
ok_cnt,
nio_cnt,
err_descr,
cnt,
na_cnt,
shift_no,
shift_start,
shift_end,
inserted_date
FROM
ProtocolNOKParts.qvd
(qvd) where $(vupdateddate) < inserted_date ;
Concatenate(Test2)
LOAD wp_name,
descr,
erp_ord_no,
art_no,
art_descr,
ok_cnt,
nio_cnt,
err_descr,
cnt,
na_cnt,
shift_no,
shift_start,
shift_end,
inserted_date
FROM
[NOK Data.qvd]
(qvd) Where not Exists(wp_name);
STORE Test2 into Test4.qvd(qvd);
DROP Table Test2
Can you try modifying the incremental script to :
Test1:
LOAD max(inserted_date) as max_date
Resident Test;
LET vupdateddate = Date(Peek('max_date',0,'Test1'));
Test2:
LOAD wp_name,
descr,
erp_ord_no,
art_no,
art_descr,
ok_cnt,
nio_cnt,
err_descr,
cnt,
na_cnt,
shift_no,
shift_start,
shift_end,
inserted_date
FROM
ProtocolNOKParts.qvd
(qvd) where Date(inserted_date) >= '$(vupdateddate)'
Thanks
CY
Test2:
LOAD wp_name,
descr,
erp_ord_no,
art_no,
art_descr,
ok_cnt,
nio_cnt,
err_descr,
cnt,
na_cnt,
shift_no,
shift_start,
shift_end,
inserted_date
FROM
ProtocolNOKParts.qvd
(qvd) where '$(vupdateddate)' < inserted_date ;
Please check if the format of your variable vupdateddate is same as the inserted_date using the log file..
this is the output i am receiving in the attached file. but i need the data after the max_date that should be from 27-03-2018 23:00:02.
i have checked with another sample data set and with the logic that i have used earlier it was showing correct result. but the main problem comes with this dataset that i am using.
No i am not getting the correct answer. i should get the result after the max_date but in the output it is considering the max_date too.
I Tried in this manner, Please do have a check on it.
e.g.
Data:
LOAD wp_name,
descr,
erp_ord_no,
art_no,
art_descr,
ok_cnt,
nio_cnt,
err_descr,
cnt,
na_cnt,
shift_no,
shift_start,
shift_end,
inserted_date
FROM
(qvd);
Last_Updated_Date:
load
Max(inserted_date) as MaxDate
resident Data;
let Last_updated_date=peek('MaxDate',0,'Last_updated_date');
Drop Table Data;
Incremental:
LOAD wp_name,
descr,
erp_ord_no,
art_no,
art_descr,
ok_cnt,
nio_cnt,
err_descr,
cnt,
na_cnt,
shift_no,
shift_start,
shift_end,
inserted_date
FROM
(ooxml, embedded labels, table is Sheet1)
where inserted_date>$(Last_updated_date);
Concatenate
LOAD wp_name,
descr,
erp_ord_no,
art_no,
art_descr,
ok_cnt,
nio_cnt,
err_descr,
cnt,
na_cnt,
shift_no,
shift_start,
shift_end,
inserted_date
FROM
(qvd)
where not Exists(wp_name);
inner join
LOAD wp_name
FROM
(ooxml, embedded labels, table is Sheet1);
Store Incremental into 'C:\Users\Documents\My QVW\Incremental Load\t1.qvd'(qvd);
drop Table Incremental;
Try formatting the date
LET vupdateddate = Date(Peek('max_date',0,'Test1'),'YYYY-MM-DD hh:mm:ss');
Load ...
ProtocolNOKParts.qvd
(qvd) where '$(vupdateddate)' < inserted_date ;