Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

is it possible to use subroutine as like built-in function

Hi All,

could you please let me know is it possible to use user defied subroutine as like built-in function. For example built-in function sum we can use for summing of values. similarly can we define subroutines and can we use anywhere in the app?. I mean in Expressions. Thank you very much in advance for your help.

Regards,

GK

3 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You can store expressions in variables and pass parameters to them. For example:

A variable vSumOfField with one parameter: sum($1)

An expression using the variable and passing as paramter value the field name Amount: =$(vSumOfField(Amount))

This way you can build you're own subroutines. You can't use UDF coded in for example C/C++ or java. There does exist a hidden easter egg setting AllowMacroFunctionsInExpressions that allows you to use functions created in the macro editor in expressions.


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Gysbert Wassenaar,

thank you for reply. here is simple example for my requirement.

sub mySum(a,b)

gksum=a+2+b-2  //gksum is defined variable

ENDSUB

now can I call mySum subroutine in expressions?

Thank you.

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

No. You can't use subroutines in expressions.


talk is cheap, supply exceeds demand