Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
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.

22 Replies
avinashkk696
Contributor III
Contributor III
Author

Hello Sachin,

Please find the below attachment. I am getting the value. But I also need inverted comas("") also. I tried modifying. If it works in one way, it is not working in the other way. Please have a look at the same.

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()?

sdmech81
Specialist
Specialist

HI,

Plss try like this:

Create variable like vShow=''&'("'& Concat(Country,'"|"')&'")'&

and then pass that vShowas shown below..It works

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

Sachin

sdmech81
Specialist
Specialist

Hi Sunny,

If u use get filed selection and select all in list box..It ll show ALL.

And avinash wants it to be shown as all values rather than ALL string.

So created variable to check fr all n done like this.Thanks

Sachin

sunny_talwar

Did you look at my response above?

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

I have also attached a sample to look at.

Capture.PNG

Anonymous
Not applicable

Hi all, While using the concat function, in the current selections its showing the expression like (Value1|Value2|...). Can we avoid this and display in  the current selections like it will do when a normal selection is done.

Thanks in advance.

sdmech81
Specialist
Specialist

Hi,

@ Shiva only....R u continuing Avinash's thread r separate one..

If separate,then normal expression something like:

=GetFieldSelections(Country)

would give u how current selection gives u the data..

Sachin

sdmech81
Specialist
Specialist

FYI, Avinash

The above expressions can b done using either concat() or even with GetFieldSelections() to bring that (" ")..

Hope its done?

Sachin

avinashkk696
Contributor III
Contributor III
Author

Hello Sunny,

Thanks a lot. Your expression did work well. But could you explain me what that "10000" means over there for my future reference??

sunny_talwar

GetFieldSelection has an upper limit of how many selected value it shows before it starts to aggregate the selections. In order to expand the upper limit, you can provide this additional parameter which will tell your expression to not aggregate until 10000 or 10000000.

Also, check these links out:

https://help.qlik.com/en-US/qlikview/12.1/Subsystems/Client/Content/ChartFunctions/FieldFunctions/ge...

Missing Manual - GetFieldSelections() + Bonus Example