Call
The call control statement calls a subroutine which must be defined by a previous sub statement.
Syntax:
Call name ( [ paramlist ])
Arguments:
Argument | Description |
---|---|
name | The name of the subroutine. |
paramlist | A comma separated list of the actual parameters to be sent to the subroutine. Each item in the list may be a field name, a variable, or an arbitrary expression. |
The subroutine called by a call statement must be defined by a sub encountered earlier during script execution.
Parameters are copied into the subroutine and, if the parameter in the call statement is a variable and not an expression, copied back out again upon exiting the subroutine.
Limitations:
-
Since the call statement is a control statement and as such is ended with either a semicolon or end-of-line, it must not cross a line boundary.
-
When you define a subroutine with Sub..end sub inside a control statement, for example if..then, you can only call the subroutine from within the same control statement.
Example:
This example lists all Qlik related files in a folder and its subfolders, and stores file information in a table. It is assumed that you have created a data connection named Apps to the folder .
The DoDir subroutine is called with the reference to the folder, 'lib://Apps', as parameter. Inside the subroutine, there is a recursive call, Call DoDir (Dir), that makes the function look for files recursively in subfolders.