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

struck with this code regarding incremental update

Hi,

I am struck with this code regarding incremental update.Can anyone please help me.WHERE NOT EXISTS not working.Thank you.

Prodincre:

LOAD ID,

     Product,

     Sales,

     Modified_Date

FROM

incremental_load.xlsx

(ooxml, embedded labels, table is Sheet1)

WHERE(Modified_Date > '$(Last_Updated_Date)'   ); //this is a string var

Concatenate

LOAD ID,

     Product,

     Sales,

     Modified_Date

FROM

Product.qvd

(qvd)

Where Not Exists(ID);

15 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

The code looks fine. What indicates that it isn't working?

Can you post an example qvw and source files that demonstrate the problem?


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Hi here is the snapshot of what is coming .I want to eliminate duplicate record in incremental load. Here updateincre.PNG

Prod:

LOAD ID,

     Product,

     Sales,

     Modified_Date

FROM

Product.qvd

(qvd);

// A table with a new field MaxDate;

[Last updated date]:

LOAD

max(Modified_Date) as MaxDate

Resident Prod;

//Pull the MaxDate field from first row into a variable

let Last_Updated_Date = peek(MaxDate,0,[Last updated date]); //this is a string type

drop Table Prod;

 

Prodincre:

LOAD ID,

     Product,

     Sales,

     Modified_Date

FROM

incremental_load.xlsx

(ooxml, embedded labels, table is Sheet1)

WHERE(Modified_Date > '$(Last_Updated_Date)'   ); //this is a string var

Concatenate

LOAD ID,

     Product,

     Sales,

     Modified_Date

FROM

Product.qvd

(qvd)

Where Not Exists(ID);

//for deleteting qvd record whre the record is not there in xlsx

inner Join

LOAD ID,

     Product,

     Sales,

     Modified_Date

FROM

incremental_load.xlsx

(ooxml, embedded labels, table is Sheet1);

store Prodincre into Product.qvd(qvd);

drop table Prodincre;

  modified:

LOAD ID,

     Product,

     Sales,

     Modified_Date

FROM

Product.qvd

(qvd);

sudeepkm
Specialist III
Specialist III

normally there should be a check for the QVD exists or not prior concatenating the data from QVD. For first time load of this script (when QVD does not exist or not yet created) will give load error.

Anonymous
Not applicable
Author

Hi Sudeep,

QVD is there thing is duplicate record is not eliminated .

Thank you.

sudeepkm
Specialist III
Specialist III

what is the value of Last_Updated_Date (MaxDate) from qvd ?

Anonymous
Not applicable
Author

Hi Sudeep,

The maxdate is max(Modified_Date) as MaxDate from qvd;

for the above code  insert and delete are working only duplicate record is not removed with NOT EXsits.

Thank You

Anonymous
Not applicable
Author

Just for testing purposes, see if this works.

Prodincre:

LOAD ID,

ID as ID_EXCL,

     Product,

     Sales,

     Modified_Date

FROM

incremental_load.xlsx

(ooxml, embedded labels, table is Sheet1)

WHERE(Modified_Date > '$(Last_Updated_Date)'   ); //this is a string var

Concatenate

LOAD ID,

     Product,

     Sales,

     Modified_Date

FROM

Product.qvd

(qvd)

Where Not Exists(ID_EXCL ,ID);

Drop field ID_EXCL;

Anonymous
Not applicable
Author

Hi Wallo,

Thank you for your response. I tested the you have given . It is still showing the duplicate record.

Thank you

Anonymous
Not applicable
Author

Are you sure both duplicate records aren't just coming from the Excel sheet?