Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I know you can have sub routines in an Include file such as...
sub something(param1, param2)
...qlikview code
end sub
Can you put a custom function in an Include file such as...
function GetSP(DocLibrary, DocName)
Let vTitle = Title;
Let vLeafName = LeafName;
Tab1:
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
end function
Thanks in advance for any assistance.
Hi there.
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.
Kind regards,
Rrnesto.
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 vTitle = Title;
Let vLeafName = LeafName;
Tab1:
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)');
LET vGetSPReturn = vMAXTimeLastWritten
end Sub