Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
waqasshah
Creator
Creator

How to store textbox calculation in a global variable.

Hi Guys,

I am facing difficulty in storing  values from textbox. I have some complex calculations in my textbox using if else conditions. The final result set  is a numeric value and I need to store it in a variable so I can use it later for other calculations. The value in the text box changes when one of the button is clicked.

I know there is a function called getfieldselections() but I think that cannot be used for text boxes. Please correct me if I am wrong.

Please guide me how we can store the value (calculations ) of the text box object in to a variable?

Kind Regards

Waqas Shah

4 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

I am not sure if I understand your issue correctly. Do you want the variable to track the selection changes, or do you want it to store the value using the earlier selections?

For the former, define the variable with the same expression as the textbox (including the leading = sign).

For the latter, define a button and use a set variable action and the same expression in the value box (with the = sign). Then you can click the button to update the variable with the value of the expression (which will not change if the selections change).

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
waqasshah
Creator
Creator
Author

Thanks Jonathan

Actually I want store the values when the button is pressed and calculations are done. let me give you the example

I want to perform simple calculation like

Calculation =   If (site = London, a x b, C x  B ),

                      If (site = Manchester, E x F,  G x H )

I want to write the above code in  text box. When I press site button the calculation changes. I hope it clarifies the situation

jonathandienst
Partner - Champion III
Partner - Champion III

>> I want store the values ...

>>I want to write the above code in  text box...


Now i'm confused. Do you want the values in a variable ('stored') or in a text box? In any case, the logic is the same as I outlined earlier.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
waqasshah
Creator
Creator
Author

Apologise I want to store the values in a global variable