Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I know I can create subs in qlikview, but can you also create a function in the script?
e.g
function CheckIfFileExists(filename)
bla bla
end function
next to this: it seems qlikview only accepts subs with at least one parameter? (I am now using a dummy value as parameter)
PS: I don't want to use macro's for this (unless it is the only way. I want to have all coding in the script)
Thanks for your replies!
Hi
There are no "functions" in QV, just "subs"
You should be able to have subs without parameters. (I have)
You just define it without a parenthesis after if you do not want parameters
/gg
Hi
There are no "functions" in QV, just "subs"
You should be able to have subs without parameters. (I have)
You just define it without a parenthesis after if you do not want parameters
/gg
No, I don't believe you can have VB functions in load scripts. You can however do loops - for example, while, for etc. which you might find useful
At least you can have Subs with parameters..
It is possible to use VBScript or JScript functions in the load script but it slows down the load process and the load statement cannot be spread into parallel threads.
- Ralf
Hi Thank you.
I don’t need VB/java functions. I would just like to have the “function” à a sub that returns a value
Is that also not possible? The ref. manual only refers to subs.
Thanks!
A thanks, that is the answer. But it is not possible to provide a return value then?
Not a proper "return value", however all variables used in the sub are also available from the outside, so you can assign a variable a value in the sub which are accessible from the calling environment.
You could use variables as functions for simple tasks like this:
SET FileExists = if(len(FileSize($1)) > 0, -1, 0);
LET vExists = $(FileExists('dir\filename.ext');
// from Rob Wunderlich´s Qlikview Components (QVC)
- Ralf