Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

incremental load, delete old field and replacing it with new field, same name

Dear all,

I have an incremental load running every week, which is just adding data on the bottom of the qvx.

it is my intention to add a flag field, in order to detect which data is the most recent one, so to easily make some selections in the qvw.

Therefore I thought of the following:

Loading the new data from the server, adding a field and populating it with 1s

Loading then the "old" data from the qvx, dropping the field (so I get rid of the 1s from the previous week) and ultimately append to this the freshly loaded data from the server (with the 1s)

But "of course" it goes wrong, as when I drop the field with the 1s, it drops also the newly created one from the server...

here is the script:

Master:

LOAD

*,

Today() AS DayStamp,

1 as LatestMaster;

SQL SELECT *

FROM SERVER.GOAM;

LOAD *

FROM \\folder\Master.qvx (qvx);

DROP FIELD LatestMaster;

STORE Master INTO \\folder\Master.qvx (qvx);

Much appreciated if you can help me out here; though I an thinking that probably I am going a long way to simply be able to select the values with the latest DayStamp...

thank you!

1 Reply
sbaldwin
Contributor III

Re: incremental load, delete old field and replacing it with new field, same name

Hi, i think you are basically there all you need to do is not try and store all of the fields into your qvx, lets say you have columns named col1 and col2 in your GOAM table, try the below:

Thanks

Steve

Master:
LOAD
col1,col2,
Today() AS DayStamp,
1 as LatestMaster;
SQL SELECT *
FROM SERVER.GOAM;

concatenate (Master)
LOAD col1,col2
FROM \\folder\Master.qvx (qvx);

STORE col1,col2 from Master INTO \\folder\Master.qvx (qvx);


Community Browser