How to limit number of selections in value filter

I have a Chart having ‘City’ as Slicer. I have connected a Value filter to this chart for the Hierarchy ‘City’. Now the ‘City’ hierarchy has over 50 cities. Is there a way to limit the number of ‘Cities’ the user can select in the value filter?

Sorry @david.glickman, but that option limits which values I want to be shown on the filter. My question pertains to the ability that the user is able to select only a limited number of values from the list at any given time. For example, the user should not be able to select and view lines for more than 5 cities on the chart.

I hope it is clearer now.

hmm, yes we have done that before on our dashboards.
I don’t think there is a built in way - I hope there is.

We did our own checkboxes, with an update button and a script that caught the filter values, counted them and then reset if necessary. Not ideal I know but it worked.

Hi Ravi,

Yes, David is right, there is currently no inbuilt way to restrict the number of items a user can select from a parameter hierarchy filter. But, you can control this using scripts. For this you will have to add a script in the parameter value changed event of your parameter hierarchy filter that will check how many items has the user selected - viewParameter.parameterValue.values.length
https://www.dundas.com/Support/learning/documentation/create-view-content/how-to/modify-a-filter-/-view-parameter-using-scripting#h3-4-collectionmember
and if this length exceeds the expected limit than we can remove the exceeded number of items from this and can re-assign the result to the viewParameter.parameterValue.values

You can then use the view service to show an alert to the user, notifying about the items removed. This could basically read the captions of all the items removed and shows it in an alert of type warning

I hope this helps.

Would be nice to have as a feature request

1 Like

I’ve submitted a feature request on yours and Ravi’s behalf - it will appear as Issue 80424 on the support site.

2 Likes

Thanks, @christian.pervan

I see this was submitted as a feature request – was it ever implemented? I need to limit a filter to only single selection and found this discussion when searching for tips how to. Hoping since it’s 2 years old that there is already a magic button I’m missing :slight_smile:

The request was to limit a filter to a specific number of values selectable; this has not been implemented.

To make it single select, you can just uncheck ‘show checkboxes’ in the look section and then it becomes single selection. I always pair this with ‘change value immediately’ so that they don’t need to click on the checkmark as well.

(Not in front of it now so the options may not be 100% as I describe them)

2 Likes

Well that makes things easier :wink: Thanks for the tip!