21.01.2013 Views

QlikView Reference Manual.pdf - QlikCommunity - QlikView

QlikView Reference Manual.pdf - QlikCommunity - QlikView

QlikView Reference Manual.pdf - QlikCommunity - QlikView

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Bundle info Load * from flagoecd.csv;<br />

Bundle Select * from infotable;<br />

Back to Script Statements and Keywords (page 219).<br />

Call<br />

The call control statement calls a subroutine which must be defined by a sub statement. The syntax is:<br />

callname ( [ paramlist ])<br />

Where:<br />

name is the name of the subroutine.<br />

paramlist is a comma separated list of the actual parameters to be sent to the subroutine.<br />

Each item in the list may be a field name, a variable or an arbitrary<br />

expression.<br />

The subroutine called by a call statement must be defined by a sub encountered earlier during script<br />

execution.<br />

Parameters are copied into the subroutine and, if the parameter in the call statement is a field name, copied<br />

back out again upon exiting the subroutine.<br />

Since the call statement is a control statement and as such is ended with either a semicolon or end-of-line, it<br />

must not cross a line boundary.<br />

Examples:<br />

// Example 1<br />

sub INCR (I,J)<br />

I = I + 1<br />

exit sub when I < 10<br />

J = J + 1<br />

end sub<br />

call INCR (X,Y)<br />

// Example 2 - List all QV related files on disk<br />

sub DoDir (Root)<br />

for each Ext in 'qvw', 'qvo', 'qvs', 'qvt', 'qvd'<br />

for each File in filelist (Root&'\*.' &Ext)<br />

Load '$(File)' as Name, FileSize( '$(File)' ) as<br />

Size, FileTime( '$(File)' ) as FileTime<br />

autogenerate 1;<br />

next File<br />

next Ext<br />

for each Dir in dirlist (Root&'\*' )<br />

call DoDir (Dir)<br />

next Dir<br />

end sub<br />

call DoDir ('C:')<br />

225

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!