Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to use include files in qlikview

1) When do we use include files in qlikview?

2) What is the syntax for using includes in script

Syntax for both include and must include

3) what's the difference between include and must include. When to use what? Which one is prefered to be used?

4 Replies
florentina_doga
Partner - Creator III
Partner - Creator III

$(Include = filename )

The include variable specifies a file that contains text that should be included in the script. The entire script can thus be put in a file. A user-defined variable.

Example:

$(Include=abc.txt);

I.e. the construction set Include =filename is not applicable.

Anil_Babu_Samineni

Please start using community so you will get all basic stuff from help itself

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
oscar_ortiz
Partner - Specialist
Partner - Specialist

The idea behind include files is to give you the ability to share a bit of code within multiple QVW files.

The syntax is as florentina.dogaru‌ mentioned.

The difference between include and must include is that the include fails silently.  What I mean by that is that if the file specified does not exists it will skip past that bit of code.  The mus include will produce a hard fail if the file does not exist.

$(Include = filename )

$(Must_Include = filename )

Good luck!

Oscar

MK9885
Master II
Master II

Below is the Include text I use in Qlik Data Load Editor....The red dots before \include is folder directory up or down (forward or back).

// DATABASE CONNECTION

LET vInclude_Filename = '..\Includes\DBConnection.txt';

LET vInclude_Directory = '..\Includes\Variables.txt';

TRACE <LOG> Attempting to INCLUDE file [$(vInclude_Filename)];

IF IsNull (FileTime( vInclude_Filename )) THEN;

TRACE File doesnt exist [ $(vInclude_Filename) ];

EXIT SCRIPT ;

END IF;

$(must_include=$(vInclude_Filename));

TRACE ('[$(vInclude_Filename) ] file was found and incorporated into script');

$(must_include=$(vInclude_Directory));

and you'd need to place the attached document in Include Folder or any other folder you like but then accordingly you'd have to modify the destination in include script..

Same kind of text document would got for Data Base Connection. Where you store your connection string(s).

And I agree with Anil, most of the answers to your questions are already available in community. Just search it and you'll get it.