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: 
sagarwal16
Partner - Contributor II
Partner - Contributor II

this is the code i have written but problem is i am getting the value as vupdateddate in newly added record but want only newly added records.

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

6 Replies
ychaitanya
Creator III
Creator III

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

sasiparupudi1
Master III
Master III

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..

sagarwal16
Partner - Contributor II
Partner - Contributor II
Author

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.

sagarwal16
Partner - Contributor II
Partner - Contributor II
Author

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.

vishalarote
Partner - Creator II
Partner - Creator II

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;

sasiparupudi1
Master III
Master III

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 ;