Discussion Board for collaboration on QlikView Scripting.
I know you can have sub routines in an Include file such as...
sub something(param1, param2)
Can you put a custom function in an Include file such as...
function GetSP(DocLibrary, DocName)
Let vTitle = Title;
Let vLeafName = LeafName;
load max(TimeLastWritten) as MAXTimeLastWritten
from X:\TSollenberger\_QVDs\Layer1\PRD_SP_DocumentInfo.qvd (qvd)
where tp_Title = '$(vDocLibrary)'
and LeafName = '$(vDocName)';
LET v_MAXTimeLastWritten = Date(peek('MAXTimeLastWritten'), '$(TimestampFormat)');
GetSP = vMAXTimeLastWritten
Thanks in advance for any assistance.
As far as I know there are no user-defined functions in the script, only subroutines.
You can, however, define your functions in a macro module and call them from your script.
As Ernesto mentions, functions can be written as macros, however I personally try to avoid macros. One way to achieve something similar might be to write a subroutine, and use it to set a variable. This can then be used in your script.
Easy way is using a Sub, as you are used to setting a variable
Sub GetSP(DocLibrary, DocName)
LET vGetSPReturn = vMAXTimeLastWritten