Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to select in a field by values which are possible values in other fields?

I have 3 fields, there are Country, City, Geo.

Country: USA,Russia,China,...

City: New York, Shanghai,...

Geo: Russia,New York,Usa,Shanghai,..

I want to select the values(which possible in Country or City) in Geo.

set v_Geo=ActiveDocument.Fields("Country").GetPossibleValues

Is it possible =>

add ActiveDocument.Fields("City").GetPossibleValues into v_Geo?

then ActiveDocument.Fields("Geo").SelectValues v_Geo

5 Replies
erichshiino
Partner - Master
Partner - Master

Hi,

Please, check if the application attached solves your problem.

Regards,

Anonymous
Not applicable
Author

Thank you Erich.

Anyway, I would like to know how to combine 2 variables values into 1.

erichshiino
Partner - Master
Partner - Master

You can create a variable for your case like this (go to document properties -> Variable overview ->Add

vSelections ='(' & concat(DISTINCT CHR(34) & COUNTRY & CHR(34), '|')
& IF( COUNT(DISTINCT COUNTRY)>0,'|') & concat(DISTINCT CHR(34) & CITY & CHR(34), '|') & ')'

Anonymous
Not applicable
Author

Dear Erich, can it be achieved in Macro?

johnw
Champion III
Champion III

Probably this.

set field = ActiveDocument.Fields("Geo")
field.selectValues ActiveDocument.Fields("Country").getPossibleValues
field.selectValues ActiveDocument.Fields("City").getPossibleValues,true