Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Using QV10 SR3. Can you create a Function or Sub with an optional argument? For example, can I create a Function like:
Function AddEmUp (a, b, optional c)
AddEmUp = a + b + c
End Function
Here, the argument c is optional...so it works if I pass it two or three arguments.
You can create a function variable (dollar sign expansion with arguments), e.g.
Define in the script:
Set vDateDiff = if(len($2)=0, today(), $2) - $1;
Then you can call vDateDiff with one or two arguments (second argument defaults to today()):
=$(vDateDiff('1/1/2012'))
=$(vDateDiff('1/1/2012','2/1/2012'))
Also, please read this post :
http://qlikviewmaven.blogspot.co.uk/2011/04/variable-that-acts-like-user-defined.html
Thanks,
DV