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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

For each to create qvd

I have a table like this :

Table 1:

Champ1

Champ2

Champ3

Champ4

A

1

I

UN

B

1

J

UN

C

1

K

DEUX

D

1

L

DEUX

I want to do a loop on Champ 4 to create a qvd for each value of Champ4

I have with an other loop create a field vListe = ‘UN;DEUX’

But I not arrive to write a good script.

For each ????????????? in vListe
QVTAble:
NoConcatenate
LOAD
champ1,
champ2,
champ3
Resident
Table 1
WHERE champ4 = ??????????????;

STORE QVTAble INTO C:\Fichier?????????????.qvd;
DROP table QVTAble;

Next ????????;

Can you help me please to replace ?????????? bye the good value?

Thank you for your help…

1 Solution

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

hei
use this script
BaseData:
LOAD * INLINE [
Champ1, Champ2, Champ3, Champ4
A, 1, I, UN
B, 1, J, UN
C, 1, K, DEUX
D, 1, L, DEUX
]
;


BaseList:
load distinct Champ4 as fieldlist
resident BaseData;

let counter = NoOfRows('BaseList');

for i=0 to $(counter)-1
let vFilter =peek('fieldlist',$(i),'BaseList');
Data:
load Champ1,
Champ2,
Champ3
resident BaseData
where Champ4 ='$(vFilter)';

store Data into '$(vFilter).qvd';
drop table Data;

next

View solution in original post

2 Replies
lironbaram
Partner - Master III
Partner - Master III

hei
use this script
BaseData:
LOAD * INLINE [
Champ1, Champ2, Champ3, Champ4
A, 1, I, UN
B, 1, J, UN
C, 1, K, DEUX
D, 1, L, DEUX
]
;


BaseList:
load distinct Champ4 as fieldlist
resident BaseData;

let counter = NoOfRows('BaseList');

for i=0 to $(counter)-1
let vFilter =peek('fieldlist',$(i),'BaseList');
Data:
load Champ1,
Champ2,
Champ3
resident BaseData
where Champ4 ='$(vFilter)';

store Data into '$(vFilter).qvd';
drop table Data;

next
Not applicable
Author

Hi Liron,

thank you very much, it's exactly what i want...it's perfect

have a nice day