Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load a Chunk of Data into Different Tables

I have a large *.qvd which has 100 fields.  I want to break down the large *.qvd and load it into 4 separate tables with 25 fields each in each table.  How do I do this?

Thanks.

1 Solution

Accepted Solutions
jdf
Employee
Employee

What you can do is create a variable in the beginning of your script.

let vQVD1=PRIMARYKEY,field1,field2,field3,field4,.....,field25;

let vQVD2=PRIMARYKEY,field26,field27,field27,....,field50;

let vQVD3=PRIMARYKEY,field51,field52,field53,....,field75;

let vQVD4=PRIMARYKEY,field76,field77,field78,....,field100;

this way you can change to fields you want in each qvd at the beginning of script.

QVD1:

Load $(QVD1) from DATASOURCE;

Store * from QVD1 into QVD1.qvd;

QVD2:

Load $(QVD2) from DATASOURCE;

Store * from QVD2 into QVD2.qvd;

QVD3:

Load $(QVD3) from DATASOURCE;

Store * from QVD3 into QVD3.qvd;

QVD4:

Load $(QVD4) from DATASOURCE;

Store * from QVD4 into QVD4.qvd;

Jacob N. Dockendorf

View solution in original post

5 Replies
Not applicable
Author

Hi,

There is no easy way to give you a solution based on the above problem description.

If you can post some sample data then we can think of alternate solutions for the same.

The baisc concept would be identify the unique identifier (column data) for each set of row data may be RecID then load first 25 columns with RecID and then load 25 other columns along with RecID and so on..

So all the 4 tables (each have 25 columns + RecID) get linked via RecID.

But the problem is if the data is not able to identify uniquely by this RecID you may need to create a composite key to link all the tables.

Hope this may help you.

Cheers.

its_anandrjs

Hi,

You need to break the one qvd into seperate 4 so to achive this you need to load a data by 4 times and on this load make a 4 qvds. But first of all you need to get how many rows are there in the qvd by the Recno( ) command and then break this into 4 parts after this load data for times like

Ex:-

Total rows 200

200 / 4 = 50

First load 50 records and make qvds like ways for remaning 3 you need to load the data and make qvd

Store the total records value into variables and divide it into 4 parts and use this valu to load and then use a counter variable to laod data 4 times by the use of variable like vRun = 4, vRowDiv = 200 / 4 like ways

By the use of Counter and Recno( ) in syntax like

Load

From Data

Where Recno( ) <= ( vRowDiv )

load this four times and create a QVD

HTH

Regards

Anand

Not applicable
Author

Okay, I do have a PrimaryKey value that I will be using.  I also forgot to mention I want to break these down dynamically.  Sometimes my calculated values in the data changes, so I cannot just do

Load field1 - field 25 from ...

I need a way to load and join them without eating all of my memory. 

jdf
Employee
Employee

What you can do is create a variable in the beginning of your script.

let vQVD1=PRIMARYKEY,field1,field2,field3,field4,.....,field25;

let vQVD2=PRIMARYKEY,field26,field27,field27,....,field50;

let vQVD3=PRIMARYKEY,field51,field52,field53,....,field75;

let vQVD4=PRIMARYKEY,field76,field77,field78,....,field100;

this way you can change to fields you want in each qvd at the beginning of script.

QVD1:

Load $(QVD1) from DATASOURCE;

Store * from QVD1 into QVD1.qvd;

QVD2:

Load $(QVD2) from DATASOURCE;

Store * from QVD2 into QVD2.qvd;

QVD3:

Load $(QVD3) from DATASOURCE;

Store * from QVD3 into QVD3.qvd;

QVD4:

Load $(QVD4) from DATASOURCE;

Store * from QVD4 into QVD4.qvd;

Jacob N. Dockendorf
Not applicable
Author

I believe this will do the trick.  Thanks.