
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Executing scripts by parts
Hi,
Is it possible to execute a part of a script?.
I don't want to execute the whole script, only a part of it..
Thanks
- Tags:
- new_to_qlikview

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is just a one off for diagnostics / testing, or a permanent thing ?


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes.
You use the Sub and Endsub statements and then use Call Subname; to run the different parts.
for instance, if you are reading 3 tables and storing to disk you can do this:
Sub Table1
load * from table1;
Store table1 into table1.qvd (qvd);
Drop table table1;
endsub
Sub Table2
load * from table2;
Store table3 into table2.qvd (qvd);
Drop table table2;
endsub
Sub Table3
load * from table3;
Store table3 into table3.qvd (qvd);
Drop table table2;
endsub
Call Table1;
Call Table2;
//Call Table 3 //This part of the script will not run unless you uncomment this line


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For testing purposes, you can re-order the tabs and use the command "Exit Script;" to stop execution at that point.
If you start the debugger, you can also limit the load sizes, step through the script and monitor variables and $ expansions.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you are working with lots of tabs and want control over them, you'll probably put all your Calls in one tab. Just make sure you demote that tab right to the end of your script since the Sub has to be declared before use.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can also make use of
if then
else if
end if
based on the conditions will can manage the execution of the script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Open the offending Qlikview.
File->Save As-> 'Test' (or some other name that will clone it and leave the original alone)
Delete the good tabs, test run the offending tab(s). (Keep your section access and connection strings though, and mapping loads you might have at the start of your script. )
Fix and copy/paste your repaired script back to the main QVW.
Rinse and repeat until you get all the kinks out - though you can just delete the repaired tabs from your test-clone now to keep going from whatever other snags you encounter.
My main extract qlikview failed about 20 tabs in due to a bad table reference I overlooked after doing an inner join overhaul to better limit the data it's pulling from the database. I did the above steps and kicked off the last dozen or so tabs from the test-clone I made.
Have a nice day!
