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: 
schmidtj
Creator II
Creator II

Data editor & for each

Hi,

i think i have a pretty simple question.

I would like to set an array in my data editor script with a few values.

I would like then to export a QVD file as often as i have values in that array.

I did the following so far:

SET list = ValueList('1', '2');

FOR EACH var IN list

    STORE "MY_TABLE" INTO [$(v_My_Path)/folder\$(var).qvd](qvd);

NEXT VAR;

This is working, but it only exports one file with the name: '1,2.qvd'.

Can somebody tell me how to correct this?

As well can somebody tell me if there is a good script documentation for the data editor?

The official online qlik help doesnt cover all the aspects of that script language i think.

Thanks a lot.

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

HI in that case you can create a inline table and use that in script like below

Inline:

Load * inline [

Field

1

2

];

Let vCount = noofrows('Inline');

For i =0 to $(vCount) -1

     Let var = peek('Field',$(i),'Inline');

     STORE "MY_TABLE" INTO [$(v_My_Path)/folder\$(var).qvd](qvd);

Next

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

13 Replies
sunny_talwar

May be this

SET list = 1, 2;

FOR EACH var IN list

    STORE "MY_TABLE" INTO [$(v_My_Path)/folder\$(var).qvd](qvd);

NEXT VAR;

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Try this.

FOR EACH var IN '1','2'

  STORE "MY_TABLE" INTO [$(v_My_Path)/folder\$(var).qvd](qvd);

NEXT var;

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
schmidtj
Creator II
Creator II
Author

hi,

this might work but i need to put it in a variable because i would like to set

init varaibles at the beginning of my script, which is a bit longer than my example here.

Cheers

schmidtj
Creator II
Creator II
Author

I tried this too but its not working 😕

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

stalwar1

I dont think this will work.

It wont take each value.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
sunny_talwar

Did you try what I proposed?

schmidtj
Creator II
Creator II
Author

Yes i did, not working, sorry 😕

sunny_talwar

I think dollar sign expansion is needed.... this works

SET list = 1, 2;

FOR EACH var IN $(list)

    TRACE $(var);

NEXT var;

sunny_talwar

Try this

SET list = 1, 2;

FOR EACH var IN $(list)

    STORE "MY_TABLE" INTO [$(v_My_Path)/folder\$(var).qvd](qvd);

NEXT VAR;