Skip to main content
Announcements
Save $600 on Qlik Connect registration! Sign up by Dec. 6 to get an extra $100 off with code CYBERSAVE: REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
avinashkk696
Contributor III
Contributor III

Trigger the values in one field with selection in another field

Hello Experts,

I have a requirement in which I have two list boxes (Or Say Fields) which has no Association between them. My requirement is, when I select multiple values in one list box, the same values should be selected in the other list box also.  Below is the sample code. On selection of multiple "Countries", I want same values to be selected in the "Area".

Note: I want it using triggers only. I don't want to have any association between them.


Country:
LOAD * INLINE [
Country
India
Pak
Zimb
SA
USA
NL
CHINA
CAN
]
;


Area:
LOAD * INLINE [
Area
India
Pak
Zimb
SA
USA
NL
CHINA
CAN
]
;

1.JPG

Thanks In Advance.

Please find the QVW for the reference.

1 Solution

Accepted Solutions
sunny_talwar

Try this:

=if(GetSelectedCount(Area)=0, '("'&Concat( DISTINCT Area,'"|"')&'")','("' & GetFieldSelections(Area, '"|"', 10000) & '")')

But why use Concat and GetFieldSelections at the same time? Why not sure Concat()?

View solution in original post

22 Replies
Anonymous
Not applicable

Hi,

Please see the attached app. I have created an variable an put a trigger on selection.

if(GetSelectedCount(Area)<>0, '('&Concat( DISTINCT Area,'|')&')')

Best  regards,

Cosmina

sunny_talwar

Or even this:

='("' & GetFieldSelections(Area, '"|"') & '")'

MarcoWedel

why don't you want associations between those fields?

avinashkk696
Contributor III
Contributor III
Author

Hello Marco,

Its just the sample data I have given. But my way of implementing it is different. In my datamodel if these two fields are associated, it will form a loop. And I only need to use it in one particular sheet. So I thought this would be the best option.

sdmech81
Specialist
Specialist

You need to also add this condition fr ALL selection (I mean if u select all then all should b selected in othr list box) if u go by Sunny's approach or go with popescu's approach..

It was really informative sunny ,expression helped me in passing multiple values..

Declare variable say: Try

VTotal country==GetSelectedCount(Country)

=if(GetSelectedCount(Country)=$(VTotal country),'*','("' & GetFieldSelections(Country, '"|"') & '")')

Sachin

avinashkk696
Contributor III
Contributor III
Author

Hello All,

Thanks for your response. All your inputs are really helpful. But I have a small problem here. I also want to display all the selected values in the text box. It works fine with your inputs but problem comes when I select all the values. Thank you sachin for the scenario you have mentioned. It worked for selection, but not for displaying. Could you help me on that???

Good thing is, I have achieved what I want by combining all the three replies from you guys..

=if(GetSelectedCount(Area)=0, '("'&Concat( DISTINCT Area,'"|"')&'")','("' & GetFieldSelections(Area, '"|"') & '")') 

With the above code in text box, I am getting result "ALL" when everything is selected.

2.JPG

sdmech81
Specialist
Specialist

HI,

Plss attach latest file.

Will modify in text box n give u.

Sachin

sdmech81
Specialist
Specialist

HI,

Do something of this sort and cheat the expression as per need..

=if(GetSelectedCount(Country)=$(VTotal country),Concat(Country,'|'),'("' & GetFieldSelections(Country, '"|"') & '")')

Sachin

sdmech81
Specialist
Specialist

Write above expression in your text box.

It should work..

Sachin