Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
manisha_uit
Creator
Creator

Store loop in QVD file

Hi,

I have a loop like:

LET vWeeks=0;

 

FOR counter = 2012 to year(Today()) +1

FOR counter1 = 1 to 12

 

IF WeekDay(MakeDate(counter, counter1)) = 'Sun' then

$(vWeeks)=4;

ELSEIF WeekDay(MakeDate(counter, counter1)) = 'Mon' then

$(vWeeks)=4;

ELSEIF WeekDay(MakeDate(counter, counter1)) = 'Tue' then

$(vWeeks)=5;

ELSEIF WeekDay(MakeDate(counter, counter1)) = 'Wed' then

$(vWeeks)=5;

ELSEIF WeekDay(MakeDate(counter, counter1)) = 'Thu' then

$(vWeeks)=5;

ELSEIF WeekDay(MakeDate(counter, counter1)) = 'Fri' then

$(vWeeks)=4;

ELSE

$(vWeeks)=4;

  NEXT counter1

ENDIF

          NEXT counter

Now I want to store the above loop in a qvd so that i can use it in a different qvw file

Can anyone help me on this.

Thanks

Manisha

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hi Manisha,

Do you mean to store this into a script file so you can reuse in one or more QVW files? If so, the just copy that text into an empty text file (using notepad, for example) and save it as "script.qvs" (use the double quotes).

Then, to use this code in another file, use the following line:

$(include=script.qvs);

That will add the lines in the file "script.qvs" into the current position, and they will be executed as any other instruction in the script.

Hope that helps.

Miguel

View solution in original post

2 Replies
Miguel_Angel_Baeyens

Hi Manisha,

Do you mean to store this into a script file so you can reuse in one or more QVW files? If so, the just copy that text into an empty text file (using notepad, for example) and save it as "script.qvs" (use the double quotes).

Then, to use this code in another file, use the following line:

$(include=script.qvs);

That will add the lines in the file "script.qvs" into the current position, and they will be executed as any other instruction in the script.

Hope that helps.

Miguel

manisha_uit
Creator
Creator
Author

Thanks for the instant reply Miguel.

Its working fine.

Thanks

Manisha