Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
Hi Qlik viewers,
I wanted to store the previously selected values of a field into a variable.
The scenario is like:
There is a list box with values A,B and C and Update button passing the selected value to the variable using getfieldselections.
When A is selected and update button is clicked. The variable will have A.
Next B is selected and update button is clicked the variable should contain A,B.
Is there a way out to retrieve previously selected value of a list box/multibox.
Thanks and regards,
Pratik
 vincent_ardiet
		
			vincent_ardiet
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		And if you want to let your users pick multiple values and also not do destroy the string when the clear button is pressed, change the following expressions:
First trigger on FieldA to assign vconcat:
='$(vconcat)'&if(GetSelectedCount(FieldA)>0,if(len('$(vconcat)'),',','')&concat(distinct FieldA,','))
Second trigger on FieldA to assign vconcatSA:
='$(vconcatSA)'&if(GetSelectedCount(FieldA)>0,if(len('$(vconcatSA)'),',','')&'|'&concat(distinct FieldA,'|,|')&'|')
Regards,
Vincent
 
					
				
		
Hi Vincent thanks for your reply again.
But its not giving me the desired results.
When nothing is selected vconcat is blank and vconcatSA is blank, then when i select 1 from FieldA, vconcat has 1,1 and vconcatSA has |1|,|1| and so on..
And upon using the aggr expresion in list box expression it gives blank. No values are populated in the list box.
Can u post the qvw in which you got the results, maybe I am missing some steps.
Regards,
Pratik
 vincent_ardiet
		
			vincent_ardiet
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Here it is.
 
					
				
		
Hi Vincent you qvw is the exact solution which I am looking for. Thanks alot.
The list box expression is working now, idk why but earlier it gave an error in expression. I copied yours and changed the field values this the list box popped up with values.
But I am unable to see your variable expressions. for cumul and cumul2.
Can you please paste them here.
Thanks,
Pratik
 
					
				
		
 vincent_ardiet
		
			vincent_ardiet
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Pratik,
cumul and cumul2 are just used to store the result.
The trigger actions on field col3 are using expressions to build them (see document properties/triggers/field event triggers).
 
					
				
		
Thanks Alot Vincent!
