Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Use a variable from an input box in a calculation to set another variable

Hello,

I have a situation where I need users to enter two values in an input box and then I need those numbers to be multiplied and stored in another variable to be used in a chart. I have tried both document triggers, actions in a text box, and assigning the expression to the variable with no luck. See below for details.

The user chooses the two values above (vCommAmt (15) and vCommPct (40)) from the drop down lists in input boxes.

The last part (=$600) is a text box with an expression of = $(vCommAmt)*$(vCommPct).

What I'd rather do is set a variable called vVarComm = $(vCommAmt)*$(vCommPct) and then use that variable in a chart. I have tried setting the variable in the script and setting document triggers 'On Input' and 'On Change' for the above variables but I either get nothing or an error.

Please advise.

1 Solution

Accepted Solutions
stigchel
Honored Contributor

Re: Use a variable from an input box in a calculation to set another variable

Simply define a new variable with an expression as contents like this, don't forget the =

vCalc.png

The result

vCalc2.png

Also example attached

2 Replies
stigchel
Honored Contributor

Re: Use a variable from an input box in a calculation to set another variable

Simply define a new variable with an expression as contents like this, don't forget the =

vCalc.png

The result

vCalc2.png

Also example attached

Not applicable

Re: Use a variable from an input box in a calculation to set another variable

I see what I was doing wrong...

I was defining the variable as = $(vCommAmt)*$(vCommPct) instead of =vCommAmt*vCommPct.

It's working now, thank you!!

Community Browser