Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
 cbushey1
		
			cbushey1
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		HI there,
I have a field, RiskFactor, that appears in 3 listboxes, 1 for each alternate state.
RiskFactor can not be selected in the default state.
What I want to do is select another field, Patient_Key, based on the selections made from the 3 alternate states (Risk 1, Risk 2, Risk 3).
Basically, this would give me only those Patient_Key's that have all of the RiskFactors that were selected and NOT just one of them (like a list box does).
 
					
				
		
 rwunderlich
		
			rwunderlich
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		In your button, use a Select In Field action.
1. Field: Patient_Key
2. Search Expression: ='(' & concat({Risk1*Risk2*Risk3}Patient_Key, '|') & ')'
That assumes your Patient_Key values have no spaces, if they do you have to mess with adding quotes into the search expression.
-Rob
 petter
		
			petter
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		In QlikView there is something called AND-mode which is meant for the purpose you are describing. A list box is default in an OR-mode but can be toggled into an AND-mode in it's properties dialog under certain conditions.
 
					
				
		
 cbushey1
		
			cbushey1
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Peter thanks for mentioning that option.
How can I use that with the alternate states method I outlined?
 petter
		
			petter
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		How is your data model - specifically when it comes to the tables:
PATIENT
PATIENT_RISKFACTORS (if it exists)
and
RISKFACTORS
?
 
					
				
		
 cbushey1
		
			cbushey1
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Patient table houses the Patient_Key field I am after, and it is joined to a table called RiskFactors which has two fields, Patient_ID and RiskFactor. PatientID is also in the Patient table so that is how they are joined.
 petter
		
			petter
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		With the AND-mode listbox you will not need the alternate states as you select all the risk factors from a single list box.
![2018-08-02 20_14_50-Edit Script [C__Users_Petter_Downloads_Patient Risks AND mode.qvw].png](/legacyfs/online/209740_2018-08-02 20_14_50-Edit Script [C__Users_Petter_Downloads_Patient Risks AND mode.qvw].png)
![2018-08-02 20_15_22-List Box Properties [Factor].png](/legacyfs/online/209750_2018-08-02 20_15_22-List Box Properties [Factor].png)
You multi-select by holding the CTRL-key down while clicking. You will see that the other possible selections will be in white and if these are not to be considered for the final selected patient you will have to turn them into NOT selections that have the ! and red background as an indicator. Read more about that in the links I gave you previously.
 
					
				
		
 cbushey1
		
			cbushey1
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Peter,
Thanks for this approach but this doesnt really solve the question. I need a way to select the population in the default/current state, based on selections made in other states.
The example I listed is a simplified version of what I am doing in the application and many things are relying on the different states. The thing that will make what I built truly useful is being able to make this selection.
 
					
				
		
 rwunderlich
		
			rwunderlich
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Something along the line of:
count({< Patient_Key=P({Risk1})> * <Patient_Key=P({Risk2})>} Patient_Key)
-Rob
 
					
				
		
 cbushey1
		
			cbushey1
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Thanks Rob.
How would I get my expression into a button to select the population?
I already have my populations being displayed on the screen:
Num(Sum([Risk1]*[Risk2]*[Risk3]*$ Patient_Count),'#,##0')
Not sure how to translate that into a button as I dont know how to add an expression as part of the actions.
 
					
				
		
 rwunderlich
		
			rwunderlich
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		In your button, use a Select In Field action.
1. Field: Patient_Key
2. Search Expression: ='(' & concat({Risk1*Risk2*Risk3}Patient_Key, '|') & ')'
That assumes your Patient_Key values have no spaces, if they do you have to mess with adding quotes into the search expression.
-Rob
