Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
baarathi
Creator III
Creator III

Increamental Load ODBC connected (sql data)

LastUpdatedDate:

           Load

               max(Date("TDate")) as MaxDate;


Let varLastExec = Date(Peek('MaxDate', 0, 'LastUpdatedDate'));

Let varThisExec = Date(Now());


M:

LOAD

    TDate,

    "ANO",

    BILL,

    PAY,

    "SDATE",

    "DNO",

     ADJ,

    COM,

    Cheq,

    "mk",

    "user",

    tkey,

    place,

    "icode",

    pkey;

Concatenate

     Load TDate,

    "ANO",

    BILL,

    PAY,

    "SDATE",

    "DNO",

     ADJ,

    COM,

    Cheq,

    "mk",

    "user",

    tkey,

    place,

    "icode",

    pkey from lib://QVDs/xyz.qvd

     where not Exists(thekey);

inner join

load tkey;

sql select tkey from PAN.T;


if ('$(ScriptErrorCount)') = 0 then

Store M into [lib://QVDs/temp.qvd](qvd);

Let varLastExec = '$(varThisExec)';

endif

    


SQL SELECT

    "TDate",

    "ANO",

    BILL,

    PAY,

    "SDATE",

    "DNO",

     ADJ,

    COM,

    Cheq,

    "mk",

    "user",

    tkey,

    place,

    "icode",

    pkey

FROM PAN.T

where date(TDate) <= #'$varLastExec'#;


I was trying for increamental load, but there is an error occured while script is loaded, Is the above script correct to perform increamental load ?

19 Replies
surendraj
Specialist
Specialist

Here tkey is correct one(key field) 

so it should be

where not Exists(tkey);

Ricardo_Gerhard
Employee
Employee

Dear Baarathi,

The field thekey on the statement below:

where not Exists(thekey);


You should have loaded this field previously

Exists - script function ‒ Qlik Sense

Ricardo Gerhard
OEM Solution Architect
LATAM
baarathi
Creator III
Creator III
Author

the error persists even after that

beck_bakytbek
Master
Master

Hi Baarathi,

what do you expect to achieve by that? Do you want to insert, update or delete the values?

baarathi
Creator III
Creator III
Author

As far as now i want to achieve insert, update and delete. For update i have use where not exists(tkey) and for delete i have used inner join

baarathi
Creator III
Creator III
Author

Want to achieve all the three

beck_bakytbek
Master
Master

Baarathi

check this issue: Incremental load for beginner with example

i suppose, your order of tables is wrong

big_dreams
Creator III
Creator III

I hope you read your error...

Error suggest

"Unexpected Token : thekey"


I don't see field with name as thekey in your table

Just replace with tkey instead of thekey


Regards,

surendraj
Specialist
Specialist

Did you got the same error or another one?

the error is because of the field which doesn't exist in Database(thekey)

Please make sure to place correct key field in where not Exists(tkey).

As my observation Tkey was available in database.