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

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

Multiparameter functions and Variables

Hi

I have an issues with multiparameter functions in the input parameters of a variable. I dont manage to get a variable call like $(variable ( function(a,b) , c ) ) to work, but a call like $(variable ( function(a) , c ) ) works fine.

I have attached an exampel with the code and resulting error below. Seems to me as the function is not evaluated as a whole but the comma is interpreted a parameter seperator of the variable. Any suggestions?

Regards

//Nils


set pmf_poisson = pow($1,$2) / fact($2) * exp(-1*$1);

load

$(pmf_poisson(floor(2.5),2)) as test //working

,$(pmf_poisson(floor(2.5,0.25),2)) as test_2 //not working

autogenerate(1);


Results in the following script error:


Error in expression:
pow takes 2 parameters

load

pow(floor(2.5),2)/fact(2)*exp(-1*floor(2.5)) as test

,pow(floor(2.5,0.25))/fact(0.25))*exp(-1*floor(2.5) as test_2

autogenerate(1)


2 Replies
Not applicable
Author

Hi,

Try to make a function in VBscript / JScript module . (Press CONTROL-M to see it.) For example:

function my_f(x, y)

my_f = x * y;

end function

You can call my_f(..) from script

-Alex

Not applicable
Author

Thanks for the answer. I do have a solution that works in the script. The problem is I want to be able to able to use the expression in a graph and therefore I like to use a variable instead of a funcion.

It seems to me as the current behavior is inconsistent or bugged. Any second opinions on it?

Regards

//Nils