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: 
user467341
Creator II
Creator II

Restrict selection for a particular column in straight table?

Hi,

I have this table.

user467341_0-1688539056025.png

In column Year, I only want user to select one year (and not able to let them select more than one year).

Is it possible to restrict this in the set expression/analysis?

 

Labels (3)
6 Replies
Henry_Laser
Contributor
Contributor

Good morning

The question now is what year would you want the customer to see?

what syntax did you use in your load screen for the year data?

You can use a match function in the filter FX space by using the below:

if(match(yearfunction,'yearnumber'),yearfunction). This will only show the year number you want to be visible in the filter and the rest will be a null value. You can then deselect the show null block under your Year Data.

 

udit_k
Partner - Creator II
Partner - Creator II

 

You can Restrict using field setting and check Always one Selected Value.

udit_k_0-1688555821267.png

 

user467341
Creator II
Creator II
Author

Hi Henry,

I used "=Year" dimension in the straight table. Upon load, user will see 2017 in the straight table first. They will be able to change the Year in a dropdown menu that I provide - this will allow them to only pick one year.

However, in the straight table, the user will have the ability to filter more than 1 year (as shown in the picture in my original post). I need to get rid of this. Where should I put the match function you suggested?

 

Hi udit,

I can't use this because this will lock in for my entire app. I only need it in one, and only one, sheet.

udit_k
Partner - Creator II
Partner - Creator II

Hi ,

 

You can write below expression in chart Dimension :-

=if($(=count( distinct Id))=1,Id, 'Please select one')

 

In Filter Selection Title of ID :-

=if(findoneof(concat(Id,'#'),'#')>0,'pls select one value',Id)

 

Doing this chart will always display data for only one selected value in Dimension:-

udit_k_0-1688636692971.png

 

udit_k_1-1688636724631.png

 

If we select more then one value , it will display message please select one value.

udit_k_2-1688636796212.png

 

Or
MVP
MVP

The typical approach here would be to use a calculation condition for the table:

Count(Distinct Year) = 1

And an associated message explaining the user is required to select a year.

There is no way to prevent a user from selecting multiple years (or have no selection) from a table, because they could always make the same selection via global search, a filter pane, the selections screen, etc

sidhiq91
Specialist II
Specialist II

@user467341  You can use below expression in your calculation Condition for the table:

count(distinct Year)=1

Display the message as 'Select only one Year at a time'

sidhiq91_0-1688811247024.pngsidhiq91_1-1688811293399.png