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

Add data to qvd instead of replace it

Hi. In my extract I am loading a bunch of data from a database into a qlikview table. After the table is created I am storing it into a qvd. I'm running into an issue that every time I run the extract the data replaces the previous data into the qvd. Is there code that will add the new data to the qvd and retain the old data? Currently I am using STORE * FROM Table INTO Table.qvd. I figured there might be a different code that I could use to do this. Thanks.

1 Solution

Accepted Solutions

Re: Re: Add data to qvd instead of replace it

WIldcard loads don't work properly for JOINS. You have to load all the Table2 QVDs into a temp table and then join that to Table1. Like this.

Table1:

LOAD * FROM Table1\*.qvd (qvd);

Table2:

LOAD * FROM Table1\*.qvd (qvd);

JOIN (Table1) LOAD * RESIDENT Table2;

DROP TABLE Table2;

-Rob

http://masterssummit.com

http://robwunderlich.com

11 Replies

Re: Add data to qvd instead of replace it

Nope. A qvd file is basically a memory dump of a table from qlikviews in-memory database. It's not possible to incrementally store to a qvd file. But since it is a memory dump it will be written to disk very quickly. What you can do is incremental loading and store each incremental extract into a separate qvd. Of course you then have to load all qvd's into qlikview to get the complete table.


talk is cheap, supply exceeds demand
Not applicable

Re: Add data to qvd instead of replace it

Say I create a different qvd for each day that I run the extract - is there a simple way to combine all of them together?

Re: Add data to qvd instead of replace it

Yes, wildcard loading:

Table1:

Load X,Y,Z

from *.qvd (qvd);


talk is cheap, supply exceeds demand
Employee
Employee

Re: Add data to qvd instead of replace it

Basically you can rewrite your QVD every time you run

T:

LOAD

*

FROM [yourqvd.qvd](qvd);

concatenate

SQL

[your query goes here]

store t into [yourqvd.qvd](qvd);

Check your manual for "Incremental Load"

Not applicable

Re: Add data to qvd instead of replace it

I have tried this technique, but for some reason it messes up my data model. It only works for the first qvd in the directory, and then for the other ones it seems like the joins and concatenations are not working. Any idea how I can fix this?

Re: Add data to qvd instead of replace it

The qvd's that should end up as one table should have exactly the same number of fields with the exact same field names.


talk is cheap, supply exceeds demand
Not applicable

Re: Add data to qvd instead of replace it

They definitely do because I am specifying the field names in the extract and the data model. Something is happening in the data model where it works for the first qvd, but doesnt for the other ones. I am using code in the data model like this:

Table1:

LOAD

Field1,

Field2

FROM

Table1\*.qvd (qvd);

Table2:

Left Join (Table1)

Field1,

Field3

FROM

Table2\*.qvd (qvd)

Any idea on what I'm doing wrong? Thanks.

Re: Add data to qvd instead of replace it

If I remember correctly what happens is something like this:

After creating Table1 the first qvd for table2 gets joined to Table1 which adds the field Field3 to Table1. Then next qvd is now joined not on just Field1, but Field1 and Field3. Etc, etc.


talk is cheap, supply exceeds demand

Re: Re: Add data to qvd instead of replace it

WIldcard loads don't work properly for JOINS. You have to load all the Table2 QVDs into a temp table and then join that to Table1. Like this.

Table1:

LOAD * FROM Table1\*.qvd (qvd);

Table2:

LOAD * FROM Table1\*.qvd (qvd);

JOIN (Table1) LOAD * RESIDENT Table2;

DROP TABLE Table2;

-Rob

http://masterssummit.com

http://robwunderlich.com

Community Browser