Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
PadmaV
Contributor II
Contributor II

GetCurrentSelections function

In general, GetCurrentSelections() function returns a list of the current selections in the app. If the selections are instead made using a search string in a search box, GetCurrentSelections() returns the search string. Is there a way to display the list of current selections when selections are made using a search string as well.

For example, when user types in like ‘*2020* in date fields or copy paste multiple values in the number field and hit enter, it displays only those values that we enter in the search box when using GetCurrentSelections function. But the actual values that gets selected when typing in the values in the search box is not getting displayed.

Function used to display the values - GetCurrentSelections(chr(13)&chr(10),': ',', ',50)

Any suggestion to display these values will be really helpful. Below are the example screenshots.

Typed in *2020* in the Date field, instead of displaying the dates that gets selected for the 2020 year, it displays like *2020*

PadmaV_0-1682697347094.png

Below is the Number field values copy pasted in the field and pressed enter. Instead of displaying the unique values with comma separated when we generally select, it displays all the values when copy pasting values and pressing enter.

100001
100002
100003
100004
100003
100005

 

PadmaV_1-1682697416567.png

 

Labels (1)
2 Solutions

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

If you are after specific fieldnames, you can do something with Concat like:

=Concat(Distinct Year, ', ')

-Rob

View solution in original post

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

-Use a complete if() for each column that returns either the formatted string or ''.

-Concatenate each if() with the "&" string concatenation operator. 

if(GetSelectedCount(DateTest)>0,'DateTest '&Concat(Distinct DateTest, ', ')&chr(13)&chr(10),'')
&
if(GetSelectedCount(NumberTest)>0,'NumberTest '&Concat(Distinct NumberTest, ', ')&chr(13)&chr(10),'')

-Rob

View solution in original post

5 Replies
Chanty4u
MVP
MVP

Try this for selected values

 

Concat({<DateField= {"$(=SelectedValues(DateField))"}> } Distinct DateField, ', ')

 

For the number field you can use below 

Concat({<NumberField= {"$(=SelectedValues(NumberField))"}> } Distinct NumberField, ', ')

 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

If you are after specific fieldnames, you can do something with Concat like:

=Concat(Distinct Year, ', ')

-Rob

PadmaV
Contributor II
Contributor II
Author

Thanks a lot @rwunderlich. This really works at individual column level. 

In our dashboard, we have around 50 columns in a table and we need to create 50 separate measure columns for each of the fields to achieve this functionality. Keeping all the 50 columns in one measure column using if condition is not displaying the values for all the selections, just the first selection column value is getting displayed. Any suggestion to overcomes this will be really helpful.

Expression Used:

if(GetSelectedCount(DateTest)>0,'DateTest '&Concat(Distinct DateTest, ', ')&chr(13)&chr(10),
if(GetSelectedCount(NumberTest)>0,'NumberTest '&Concat(Distinct NumberTest, ', ')&chr(13)&chr(10)))

PadmaV_0-1683024267158.png

 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

-Use a complete if() for each column that returns either the formatted string or ''.

-Concatenate each if() with the "&" string concatenation operator. 

if(GetSelectedCount(DateTest)>0,'DateTest '&Concat(Distinct DateTest, ', ')&chr(13)&chr(10),'')
&
if(GetSelectedCount(NumberTest)>0,'NumberTest '&Concat(Distinct NumberTest, ', ')&chr(13)&chr(10),'')

-Rob

PadmaV
Contributor II
Contributor II
Author

@rwunderlich Thank you so much. This works great.