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

1 “Set Variable” action affect many variables

Hi,

I am wondering if there is a way to have 1 "Set Variable" action affect many other variable.

For example, regarding hierarchical variables...

I would like to assign the value of a level 1 variable to override all the values of the related level 2 variables.  Perhaps they could get listed with a separator between each variable?

e.g. the following image is the essence, but it does not work:

pic1.jpg

If there is no way to do it in the Qlikview environment, please provide resources that will help me create a macro (I have lots of experience in coding in VBA).

1 Solution

Accepted Solutions
Not applicable
Author

Thank you all for the responses.  To close the loop...

1) The suggestion to create multiple "Set Variable" actions is correct, but I needed a work around to be able to mass produce this activity because my real application has hundreds of user input variables.

2) The suggestion to set the variables equal to their parent in the hierarchy is a good start, but I needed my end user to be able to interact with each of these hundreds of variables on the fly.

3) I settled on the use of VBA macros to accomplish this.

pic1.jpg

I made a handful of subroutines to push & pull the user input values at different levels

  • Apply L1 Rates to all
  • Recall L1 Rates
  • Apply Government L1 Rates to all
  • Recall L1 Gov rates
  • Apply L2 Rates to all
  • Recall L2 Rates
  • Apply Government L2 Rates to all
  • Recall Gov L2 rates
  • Clear All

Each of the above applies to the L3 user input variables (about 150 for each of normal and Federal Gov)

View solution in original post

4 Replies
Gysbert_Wassenaar

The Set Variable action can set the value of only one variable. You can use three Set Variable actions, one for each variable.


talk is cheap, supply exceeds demand
sunny_talwar

I agree with Gysbert, why can't you use three set variable actions for the same object giving them all the same value?

Best,

Sunny

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

What I would try is

If you are creating your variable in the script then do this

SET vTest1 =1 ;

SET vTest2 = '=vTest1';

SET vTest3 = '=vTest1';

Which mean in the UI you can assign a value to vTest1 from anyway and vTest2 & vTest3 will inherit their values from vTest1.

If you're creating your variable from Variable overview simply create vTest1 assign value of your choice then create vTest2 and give it value to be =vTest1 and same for vTest3 it value should be =vTest1.

A simple test I did quickly was to have all the variables in Input Box and assign value to vTest1 and I can see vTest2 and vTest3 having same value as vTest1.

Hope this helps

Not applicable
Author

Thank you all for the responses.  To close the loop...

1) The suggestion to create multiple "Set Variable" actions is correct, but I needed a work around to be able to mass produce this activity because my real application has hundreds of user input variables.

2) The suggestion to set the variables equal to their parent in the hierarchy is a good start, but I needed my end user to be able to interact with each of these hundreds of variables on the fly.

3) I settled on the use of VBA macros to accomplish this.

pic1.jpg

I made a handful of subroutines to push & pull the user input values at different levels

  • Apply L1 Rates to all
  • Recall L1 Rates
  • Apply Government L1 Rates to all
  • Recall L1 Gov rates
  • Apply L2 Rates to all
  • Recall L2 Rates
  • Apply Government L2 Rates to all
  • Recall Gov L2 rates
  • Clear All

Each of the above applies to the L3 user input variables (about 150 for each of normal and Federal Gov)