Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
jacek_k
Contributor III
Contributor III

How to not include part qvs script by codition or function?

I would like to know whether it is possible to execute part of the script.

QVS file:
A:
Load * from DB;

Drop table A;

 

In app:

include = above qvs file script

(Past code here to not execute: drop table A)

So, the question is can I add after include function or statement dont execute Dop table A row, or comment script parts what I don`t what include? 

I can not edit qvs I need part script from qvs. Is this possible? 

Labels (2)
4 Replies
MartW
Partner - Specialist
Partner - Specialist

you can use a variable and and if statement

so let's say you create a variable called vCheck you need an if function in the script and then you can either drop table A or don't drop it.

it should be something like this.

vCheck = 1; // 1 for drop 0 for keep

include file

if $(vCheck) = 1 then

drop table Table_A;

else

(do things with table A)

end if

jacek_k
Contributor III
Contributor III
Author

Yes, what happend if drop file is in the qvs file.

My question is: include qvf file but not 100%, for example include without drop table command. 

marcus_sommer

The content of an include-variable will be always completely executed - none exception possible.

But you could add everything needed within it - for example with any conditions within an if-loop like demonstrated from @MartW  whereby the check if certain parts are executed might go against various run-time loaded parameters or against documentname() to be able to use global include-variables which could behave differently - depending on the scenario.

Beside this you may of course use multiple different include-variables and branching appropriate. Further you may also consider to nest multiple include-variables and using a cascade of them - whereby you will further need some conditions if an use-case related behaviour is wanted.

- Marcus

MartW
Partner - Specialist
Partner - Specialist

what the include options does is when the script runs it past the script inplace of the include.

so with that you cannot exclude 10% of an include script.

however let's say that the include script loads 2 tables:

include -----------------------------------

table1

Load * from

table2

Load * from

-----------------------------------

if call the this include in your script what will happen is that Qlik will load both tables because it needs to complete the include script.

but Qlik is all in memory, so if for example you got a drop statement (drop table table1; )right after the include Qlik will extract both tables and after that it will drop table 1 leaving you with only table 2 to work with