Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

datalakeyu
Valued Contributor

How to get all the filtered item name into Text & image at Qlik Sense?

 

I have a column ‘myCountries’ containing different countries. I use ‘myCountries’ column as a filter dimension in Qlik Sense. I need to show which countries I select from ‘myCountries’ column in a Text & image part with Qlik Sense. If I put [myCountries] into the expression part of Text & image, when I select 1 country from ‘myCountries’ column, Text & image part will show the country name, but when I select more than 1 country from ‘myCountries’ column, Text & image part will show nothing.

Could you please give any suggestion?

Thanks!

 

1 Solution

Accepted Solutions
rsw
Contributor II

Re: How to get all the filtered item name into Text & image at Qlik Sense?

A simple way to do this is to use the GetCurrentSelections() function in your expression. Here's an example that returns a list of products:

GetCurrentSelections (ProductName, 30)

By default this function returns 6 values, the parameter value 30 that I've used instead sets a limit of 30 values. You can also change the record, tag and value seperators.

11 Replies
Highlighted
datalakeyu
Valued Contributor

Re: How to get all the filtered item name into Text & image at Qlik Sense?

Figure out a walking around solution: we can use CONCATENATE in Qlik to put the string together, and also use IF condition when it is necessary.

rsw
Contributor II

Re: How to get all the filtered item name into Text & image at Qlik Sense?

A simple way to do this is to use the GetCurrentSelections() function in your expression. Here's an example that returns a list of products:

GetCurrentSelections (ProductName, 30)

By default this function returns 6 values, the parameter value 30 that I've used instead sets a limit of 30 values. You can also change the record, tag and value seperators.

datalakeyu
Valued Contributor

Re: How to get all the filtered item name into Text & image at Qlik Sense?

Rod, thanks so much for your help!

I table structure is: myState, myValue, myZipCode

I use myState and KML filet to create a map.

When I click one state one the map, I would like show information about ONLY the most recent selected state information with Qlik Text&image

When I use GetCurrentSelections (myState, 1), it still shows all the states that I have clicked. But I would like to show ONLY the most recent state that I clicked on the map.

Could you please give any suggestion?

datalakeyu
Valued Contributor

Re: How to get all the filtered item name into Text & image at Qlik Sense?

Rod, thanks so much for your help!

I created a US state map with Qlik Sense. When I click on the map, I would like to show some information about the state, and I would like to ONLY show one current selected state (previously selected state will be deselected).

I use US state name as the map dimension. When I use

GetCurrentSelections (StateName, 1) & 'other information'

in the text expression, it still does not work. (text part will show all states that I have clicked on the map, I only need 1 state that I currently clicked on the map)

Could you please give any suggestion?

rsw
Contributor II

Re: How to get all the filtered item name into Text & image at Qlik Sense?

I don't think that there is a way to do that. If you have selected more than one state I don't believe there's a way to detect the order in which you selected them. The closest I can think of getting to your requirement is to include an "if" statement to detect how many states have been selected, then if the value is great than 1 display a message asking the user to please select a single state.

rsw
Contributor II

Re: How to get all the filtered item name into Text & image at Qlik Sense?

here's an example of what I described above:

if(getselectedcount(ProductName)>1,'Please select only a single product', GetCurrentSelections (ProductName, 1))

datalakeyu
Valued Contributor

Re: How to get all the filtered item name into Text & image at Qlik Sense?

Rod, thanks so much for your help!

I tried this method before, and I use a IF condition to detect if more than 1 states on the map have been selected/clicked, the Text part shows "Please only select 1 state". But this does not meet the requirement.

We do not need to detect the order which states have been selected. When we use GetCurrentSelections, it will return state_recent_clicked, ....state_second_clicked, state_first_clicked. It seems a stack operation, so I tried to use Pick function, but it still does not work.

In Qlik Sense, when we prepare states map, we have to use states as dimension. However, when we click the map to select state, we can click state one by one, and then many states will selected, or have to hold Ctrl key to select ONLY one state, but this still is not intuitive. Other BI tools, such as Tableau, could do so.

Could you please give any more suggestion?

Thanks again!

rsw
Contributor II

Re: How to get all the filtered item name into Text & image at Qlik Sense?

I was fairly certain that what I was suggesting wouldn't meet your exact requirement, as stated earlier I don't think there is a way to do it so I only offered it as a "next best possibility" option. I mentioned that there doesn't seem to be a way to detect the order in which values have been clicked because if there was we could easily pick it from the array returned by GetCurrentSelections. The order of the values in the array however seems instead to reflect the order of the values in the dimension or field.

By the way, I should have said to use GetFieldSelections instead of GetCurrentSelections it would be simpler. You can use it like this to get the last record selected:

     subfield(getfieldselections(myState,'#', 53), '#' , -1)

but it will only work if the selections made are in the order of the values in the field, which again won't work for you.

Sorry I don't have any other ideas at this time, my earlier suggestion is probably my best.

datalakeyu
Valued Contributor

Re: How to get all the filtered item name into Text & image at Qlik Sense?

Rod, thanks so much for your help!

Could you please explain the sytax below?

     subfield(getfieldselections(myState,'#', 53), '#' , -1)

what does '#', 53, and -1 mean?