Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
Hi,
Is it possible to keep the selected value of a field of a listbox in a variable (document variable, SET v_periodo = ....)?
I suppose is selected only one item in the listbox
Thanks
 
					
				
		
 alexandros17
		
			alexandros17
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		use =GetFieldSelections(field) function
 qlikmsg4u
		
			qlikmsg4u
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Use GetFieldSelections function
Create a variable like this
Let vVar1 = =GetFieldSelections(Your Field)
 
					
				
		
 jonathandienst
		
			jonathandienst
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		That will return null - the statement should be
Set vVar1 = =GetFieldSelections(Your Field);
or
Let vVar1 = '=GetFieldSelections(Your Field)';
 qlikmsg4u
		
			qlikmsg4u
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		My bad thanks for pointing,
I just wrote down with out thinking much
 Peter_Cammaert
		
			Peter_Cammaert
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		There are a number of solutions to this problem. Their effectiveness depends on the situation and on what you plan to do with them. See this picture. Every script variable should be set to the text of an expression, preceded by an equal sign. By preference, use the SET statement.

The first example allows you to define separators yourself (plus, minus, whatever). The fourth example is very useful when you want to set the variable to another value associated with the current selection in your listbox (using set analysis).
Peter
