Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
tiklam_dynasys
Not applicable

How to store data to qvd according to the value

Hi all,

I would like to do something like bwlow:

Country:

LOAD

    ABC,

    "Country code",

    Region

FROM [lib://Demo/Countries.csv]

(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

if ("Region" = AOME)then

Store Country into [lib://Demo/AOME.qvd];

end if

Is it possible?

Best Regards,

Louis

1 Solution

Accepted Solutions
tiklam_dynasys
Not applicable

Re: How to store data to qvd according to the value

it works after making some changes

SET vQVDPath = 'lib://Demo/Result QVD/';

RegionList:

Load

Region

from

[lib://Demo/Countries.csv]

(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

for i = 1 to FieldValueCount('Region')

Let vCountry = FieldValue('Region',$(i));

LET vFilePath = vQVDPath & vCountry & '.qvd';

Country:

Load

    ABC,

    "Country code",

    Region

FROM [lib://Demo/Countries.csv]

(txt, codepage is 1252, embedded labels, delimiter is ',', msq)

Where

Region = FieldValue('Region',$(i))

;

Store Country into [$(vFilePath)] (qvd);

Drop table Country;

next

Many Thx!

8 Replies
amartinez35
Not applicable

Re: How to store data to qvd according to the value

Hi,

You want to store one QVD by region ?

Gysbert_Wassenaar
Not applicable

Re: How to store data to qvd according to the value

Not like that. You can do it this way:

Country:

LOAD

     ABC,

     "Country code",

     Region

FROM

     [lib://Demo/Countries.csv]

     (txt, codepage is 1252, embedded labels, delimiter is ',', msq)

     ;

AOME:

NOCONCATENATE

LOAD * RESIDENT Country WHERE Region = 'AOME';

STORE AOME INTO [lib://Demo/AOME.qvd];

DROP TABLE AOME;


talk is cheap, supply exceeds demand
Vegar
Not applicable

Re: How to store data to qvd according to the value

Try something like this.


RegionList:

Load Region from

[lib://Demo/Countries.csv]

(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

for i = 1 to FieldValueCount('Region')

Country:

Load

    ABC,

    "Country code",

    Region

FROM [lib://Demo/Countries.csv]

(txt, codepage is 1252, embedded labels, delimiter is ',', msq)

Where

Region = FieldValue('Region',$(i))

;

Store Country into  'country-'& FieldValue('Region',$(i))&'.qvd' (qvd);

Drop table Country;

next

Please ekskuse my Norglish and Swenglish typos.
tiklam_dynasys
Not applicable

Re: How to store data to qvd according to the value

I want to store QVD according to the region value.

Example: AOME.QVD, CHINA.QVD, USA.QVD

I would like to store it by using if condition so that i can easily edit if the table structure is changed

and i do not need to change each of them. There are many countries in the region field.

Many Thx!

tiklam_dynasys
Not applicable

Re: How to store data to qvd according to the value

it works after making some changes

SET vQVDPath = 'lib://Demo/Result QVD/';

RegionList:

Load

Region

from

[lib://Demo/Countries.csv]

(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

for i = 1 to FieldValueCount('Region')

Let vCountry = FieldValue('Region',$(i));

LET vFilePath = vQVDPath & vCountry & '.qvd';

Country:

Load

    ABC,

    "Country code",

    Region

FROM [lib://Demo/Countries.csv]

(txt, codepage is 1252, embedded labels, delimiter is ',', msq)

Where

Region = FieldValue('Region',$(i))

;

Store Country into [$(vFilePath)] (qvd);

Drop table Country;

next

Many Thx!

pandunallani
Not applicable

Re: How to store data to qvd according to the value

yes it is correct, we can store after load the data only.

Vegar
Not applicable

Re: How to store data to qvd according to the value

Good,

If you've found your solution then please mark the thread as solved. It will help other to find the answer to the same problem in the future and other helpers/experts won't need to pay any more attention to this question.

Please ekskuse my Norglish and Swenglish typos.
chenlina
Not applicable

Re: How to store data to qvd according to the value

where can find Countries.csv ?I can't find it, please tell me,thank you!