Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to limit possible selections on a List

Hello all,

I have a list who contains 5 elements (2008, 2009, 2010, 2011 and 2012) I'd like to limit the user to select only 2 of them of each time, as (2008, 2009) or (2009, 2011). Is it possible?

If it's not possible, there's a way to get only the 2 majors selected? If the user selects (2008, 2009, 2011) I'd like to get (2009, 2011), this is possible?

Thanks in advance,

Eric

1 Solution

Accepted Solutions
swuehl
MVP
MVP

You could create a field event trigger (settings -> document properties -> triggers) and then create an OnSelect action for that field e.g. Year.

Select as action type Selection -> Select in Field

Then enter your field name in the field entry box

Year

(no equal sign, just the field name), and as search expression:

=if(GetSelectedCount(Year)>2,'('&max(Year)&'|'&max(Year,2)&')', if(GetSelectedCount(Year)>0,'=Year',NULL()) )

Hope this helps,

Stefan

View solution in original post

4 Replies
masha-ecraft
Partner - Creator
Partner - Creator

You are probably displaying some charts based on the user's selection.

In the chart you have 'Calculation condition' property on General tab. You can put a condition there like "count(distinct Year) = 2".

Then press 'Error messages' button on the same tab in the chart properties and add some user friendly error message for the 'Calculation condition unfulfilled'. Something like "Please select two years only".

Not applicable
Author

Hello Masha, thanks for the help.

there's a way to get only the 2 majors selected? If the user selects (2008, 2009, 2011) can I get (2009, 2011)? This is possible?

thanks,

Eric

swuehl
MVP
MVP

You could create a field event trigger (settings -> document properties -> triggers) and then create an OnSelect action for that field e.g. Year.

Select as action type Selection -> Select in Field

Then enter your field name in the field entry box

Year

(no equal sign, just the field name), and as search expression:

=if(GetSelectedCount(Year)>2,'('&max(Year)&'|'&max(Year,2)&')', if(GetSelectedCount(Year)>0,'=Year',NULL()) )

Hope this helps,

Stefan

Not applicable
Author

Hello swuehl,

this works perfectly, thanks.

Eric