Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Troubles including scripts containing "SUB" statements

I am trying to modularize a bit my report, and when I try this in my master script :

SUB GenerateStuff (a, b)

// Do stuff

END SUB

LET a=foo;

LET b=bar;

CALL GenerateStuff('$(a)', '$(b)');

It works perfectly. If I put the SUB...END SUB block in an external file and do this :

$(Include='external.script')
LET a=foo;

LET b=bar;

CALL GenerateStuff('$(a)', '$(b)');

The CALL to my GenerateStuff subroutine fails miserably.

Am I missing something here ?

Tags (2)
4 Replies
Not applicable

Troubles including scripts containing "SUB" statements

I really don't see how to make it work... Quite a pain...

Not applicable

Troubles including scripts containing "SUB" statements

You don't need quotes when using include. Also, make sure to include any file extension (.qvs is the normal extension).

For example:

$(Include=external.script.qvs);

Not applicable

Troubles including scripts containing "SUB" statements

The include part is actually called through a variable :

$(Include=$(File))

Where File is the path to the file to be loaded.

The File actually loads and the script is run (verified by a trace), but the SUB routine isn't callable.

If I copy/paste the exact SUB...END SUB block in the main script, it *is* callable.

Weird...

vadimtsushko
Contributor III

Re: Troubles including scripts containing "SUB" statements

Take a look at qlikview-components.

Itis whole library in include script - and it works.

Community Browser