Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load and Store Statements

Hello Community,

Do I have to load the table first before I can place a store statement in the script? Attached is a sample script on a word doc.

Another question I have is when I run the debugger it shows:

2008<<QV DSS 08

2008<<QV DSS 09

2008<<QV DSS 10

Shouldn't the first part with the table names so it reads:

2008<<QV DSS 08

2009<<QV DSS 09

2010<<QV DSS 10

I am open to opinions on structuring my tables I have just been pulling annual reports from Crystal and loading txt files.

Thank you,

EK

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You can add extra fields for example Year and Source. That way you get all data into one table, but are still able to find out where the data came from. This is the recommended approach in cases as yours.

MyDataTable:

LOAD

2008 as Year,

'QV DSS 08.txt' as Source,

@1 as [CAR DEL FAC],

.... etc

LOAD

2009 as Year,

'QV DSS 09.txt' as Source,

@1 as [CAR DEL FAC],

.... etc

Store MyDataTable into MyDataQVD.qvd (qvd);


talk is cheap, supply exceeds demand

View solution in original post

21 Replies
Not applicable
Author

Hi,

the reason you see '2008<<' for all tables, is that Qlikview holds identical structure in the same table.

for your first load, you created the table 2008, when you load the second table it has the same names for all fields, automatically it loads the data to the existing table. and the same happenes for 2010.

It depends what you are looking to do with the data:

You can use 'Noconcatenate' before the load statement and have the 3 tables seperatly.

You can add a field 'Year' and load it with the correct data for eacl load:

First load will be

2008 AS Year, etc

Goodluck

Not applicable
Author

Right..it would be dumb to have 4 versions of the same table broken up by year. Is it possible to have 1 table with 4 sources? (DSS 08, 09 etc.) Or is the way I have it set simplest? It feels a little bizarre having 1 big table but those 80 fields are all the fields I need...new to the developer side of things so not sure if there is an advantage to creating more table relationships.

EK

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You can add extra fields for example Year and Source. That way you get all data into one table, but are still able to find out where the data came from. This is the recommended approach in cases as yours.

MyDataTable:

LOAD

2008 as Year,

'QV DSS 08.txt' as Source,

@1 as [CAR DEL FAC],

.... etc

LOAD

2009 as Year,

'QV DSS 09.txt' as Source,

@1 as [CAR DEL FAC],

.... etc

Store MyDataTable into MyDataQVD.qvd (qvd);


talk is cheap, supply exceeds demand
farolito20
Contributor III
Contributor III

How can I compare my database and my qvd, to store only different data?

For example my qvd:

ID, Name, Age

001,Ana,18

And my database

ID,Name,Age

001,Ana,19

I wanna put the new values, but keep old data too. Supose that we don't have a modified date

Not applicable
Author

Hi,

You can do one of two things:

1. For loading both tables but removing duplicates - load both tables with a simple load statement:

table1:

Load ID,

        Name,

        Age

from table 1

Load ID,

        Name,

        Age

from table2

and then use the distinct command

noconcatenate

Table2:

load distinct

        ID,

        Name,

        Age

resident Table1;

Drop Table1;

now Table2 will rows of both tables only once for duplicates.

2. for loading ONLY different rows for the second table: you can use the function not exists.

In order to use it, you have to have the first table in memory (resident), and then load the second table.

You can do it like this

table1:

Load ID ,

         Name,

         Age AS Age1

from table 1.qvd

table2:

Load ID,

         Name,

         Age

from table2.qvd

where not exists(Age1,Age);//notice that you first write the field in the resident table

now table 2 holds the rows that don't exist in table1. you can write:

load ID,

        Name,

       Age1 AS Age

resident table1;

drop table1;

and both originals tables will be in table2;

Goodluck!

farolito20
Contributor III
Contributor III

So, the store will be:

STORE tabla2 into tabla1.qvd (qvd);

Not applicable
Author

If you refer to the first option, then yes.

You can store it under every name you find suitable:

store table2 into XXX.qvd(qvd);

when XXX can be 'table1'

Goodluck!

farolito20
Contributor III
Contributor III

If I use STORE tabla2 into tabla1.qvd (qvd), I saved duplicates. So I'm using

STORE tabla1 into tabla1.qvd (qvd);

farolito20
Contributor III
Contributor III

Do you know the way to save in my qvd the time when I added a new data in qvd?