I've just come across a bit of info about the 'Include Statement', and it looks like it would be really useful for me.
I just have one question though. The example I've found states to go to the 'Include' tab in the script editor. What, and where can I find the include tab, or can add my statement anywhere?
I know I can go through the Insert / Include Statement from the menu to insert it, but I just want to make sure its going in the right place!
There is no Include tab. Unless you first add a tab and named it Include. You could then use it to put all the include statements on.
you can add your statements in a text file (I usually use a qvs file) and then include this into your application's reload script.
Very useful for repeating code.
If your include-variable not contained a sub-routine which will be executed per call-statement (in this case you could create a script-tab for these include-variables) need the include-variable exactly there placed where these script-statements would be written out. What is more sensible depends on many things but you should only outsource code which is shared between multiple apps.
INCLUDEs are really practical. I use them a lot already and I'm constantly adding more:
All the file_paths to Excel_files I use are organized in INCLUDE_files (a normal txt_file will do);
The paths to where some apps store qvd_files are in INCLUDE_files (and of course, the apps which load those qvd_files use those same INCLUDE_files to find the paths to those qvd_files);
The complete code that creates the master_calendar for all my apps is in an INCLUDE_file;
Some "default" blocks of code that should be in every app (like a code that empties an app of data when it's copied to the backup_directory and a code to create the visibility_condition for some development_objects) are also in INCLUDE_files.
Watch out with the term "Include Statement". QlikView script has a construct that allows you to import text from another file, but it is certainly not a statement. And the difference is apparent if you try to comment out the construct.
A statement can easily be commented out by putting two slashes at the beginning of the line. You cannot do that with an include construct because in reality it's just a $-substitution that works in any line that the scirpt engine tries to read and before the engine decides what it is looking at.. What is happening with
is that the $(include ) construct will be replaced with the contents of file procedure.qvs, and the first line of that file will be commented out. Which is probably not what you want.
If you need to disable an include, replace the $-sign with two slashes and you're good.
Include statement is very useful.
You are going in right direction to insert include statement.
Edit Script > Tab Insert > Include Statement > Browse/Open your file.
This type of syntax/statement will appeared in your script editor $(Include=YourFileName.YourFileExtension);
After that, just reload your script (CTRL+R).