Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
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
Anonymous
Not applicable
Author

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!

View solution in original post

8 Replies
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

You want to store one QVD by region ?

Help users find answers! Don't forget to mark a solution that worked for you!
Gysbert_Wassenaar

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
MVP
MVP

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

Anonymous
Not applicable
Author

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!

Anonymous
Not applicable
Author

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!

Anonymous
Not applicable
Author

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

Vegar
MVP
MVP

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.

Anonymous
Not applicable
Author

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