Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 Frédéricdh
		
			Frédéricdh
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hello,
how to declare a script variable, which value depend from a value from a selection in a sheet Object and then I load the script new.
your Help will be so welcome.
thanks in advance
Frédéric
 Nicolae_Alecu
		
			Nicolae_Alecu
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hello,
You can use Input Variable Object. 
1. Declare a variable in Vizsualization part: 
2. Create Input Variable Object linked to this variable.
3. Use the variable in script.
Ex: Trace '$(vInputVariable)'; 
Good Luck!
 Nicolae_Alecu
		
			Nicolae_Alecu
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		If you use GetFieldSelections() to define the variable (vVar1), then you can do this: 
1. Define a second variable (vVar2) 
2. Add a button object
3. Add a "Set Variable Value" action and set vVar2 = '$(vVar1)' 
4. Add a "Reload Data" action to the same button 
5. Select a value
5. Click Button 
Have a nice day.
 Frédéricdh
		
			Frédéricdh
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hello, now it works and without an InputBX, just with the button and the set variable
 Clement15
		
			Clement15
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hello, it is not possible to change the value of a script variable according to selections. However, you can create variables directly in the visualization part that you can control with the variable input component.
Variable input control | Qlik Sense on Windows Help
 Nicolae_Alecu
		
			Nicolae_Alecu
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hello,
You can use Input Variable Object. 
1. Declare a variable in Vizsualization part: 
2. Create Input Variable Object linked to this variable.
3. Use the variable in script.
Ex: Trace '$(vInputVariable)'; 
Good Luck!
 Frédéricdh
		
			Frédéricdh
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Good, but I use the function GetFieldSelections to have my value in qlik and then in the script I use the variable REFNUM but the script use the function and not the value behind.
 Nicolae_Alecu
		
			Nicolae_Alecu
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		If you use GetFieldSelections() to define the variable (vVar1), then you can do this: 
1. Define a second variable (vVar2) 
2. Add a button object
3. Add a "Set Variable Value" action and set vVar2 = '$(vVar1)' 
4. Add a "Reload Data" action to the same button 
5. Select a value
5. Click Button 
Have a nice day.
 Frédéricdh
		
			Frédéricdh
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		No it doesn't work for me, i don't understand why but in the script the error is that in the Where clause, the variable vVar2 is blank.
 Frédéricdh
		
			Frédéricdh
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hello, now it works and without an InputBX, just with the button and the set variable
