Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Skip the ticket, Chat with Qlik Support instead for instant assistance.
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Optional Argument in Sub or Function

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 it works if I pass it two or three arguments.

2 Replies

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()):



Luminary Alumni
Luminary Alumni