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

Include Statement - Include Tab?!

Hi All,

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!

Thanks!

Di

8 Replies
Gysbert_Wassenaar

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.


talk is cheap, supply exceeds demand
giakoum
Partner - Master II
Partner - Master II

Hi Diane

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.

marcus_sommer

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.

- Marcus

datanibbler
Champion
Champion

Hi,

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.

Best regards,

DataNibbler

Peter_Cammaert
Partner - Champion III
Partner - Champion III

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

// $(include=procedure.qvs);

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.

engishfaque
Specialist III
Specialist III

Dear Diane,

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);

Example:

$(Include=myrowscount.qvs);

After that, just reload your script (CTRL+R).

Kind regards,

Ishfaque Ahmed

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Also be aware of Must_Include.

$(Must_Include=myrowscount.qvs)


Include fails silently. That is, there is no script error if the included file is not found. Must_Include throws a script error if the file is not found. I generally use Must_Include.


-Rob

http://masterssummit.com

http://robwunderlich.com

qlikviewwizard
Master II
Master II

Hi DiNicholls

Please close the thread if you get the answer. Thank you.