Is it possible to limit number of options chosen from a Text type?

Hi,
It is possible to limit the number of data selections ?
What I did was create the data from a google sheet, in this way the users visualize the name of the column and then, the options to check off from the rows:
1.

mpibanez_0-1686159102138.png
2.

mpibanez_1-1686159131622.png

It is possible to limit the number of selections? 

I try with COUNT([_THIS])<=5 in the valid if filed of the column but it didnt work.

Thanks!

Solved Solved
1 13 819
1 ACCEPTED SOLUTION

Yes, you should always start by explaining your setup.

So are you trying to limit the number of selections in the Evaluciones[Aguilidad Mental] column? That's where you put the COUNT() valid_if expression.
You can remove that existing valid_if expression, because Ref columns don't need them unless you're wanting to filter the referenced table in some way, which you aren't.
If you do need that in the future, put it in SuggestedValues.

View solution in original post

13 REPLIES 13


@mpibanez wrote:

I try with COUNT([_THIS])<=5 in the valid if filed of the column but it didnt work.


 

How did it not work?

Hi Marc,
I see this error:
COUNT function is used incorrectly.

Works fine for me on an EnumList column.

My problem is beacouse it is a column Text type.
I did it this way because the data to select comes automatically from my Google Sheet (if i change the row in my sheet, they change in the app).

In what type OF column do you store this data? I would do as you recommended @Marc_Dillon enumlist type field and then count the objects in the list

It is a column Text. I did it this way because the data to select comes automatically from my Google Sheet. It's not that I have them added in the app as Enumlist.
If I change the field to Enumlist it shows me the following error: Since your app does not have an allow list, you need to explicitly acknowledge that your app does not need secure access control.

How do you have multi-select/checkboxes, as seen in your screenshot, on a text column?

EnumList is the only column type you can use on a real column that is a List type, which is the only type that you can use COUNT() on. So, you have to use it.

I can't imagine that error has anything to do with your column type. More like your security and/or sign-in settings.

I also did not fully understand how you can achieve a multi-selection of a source field of type TEXT!!!

Marc, Let me show you:
I add my data from google sheet:

mpibanez_2-1686237735481.png

Then it show automatically in text type (because de rows are text):

mpibanez_3-1686237809594.png
To have multi-select I have this another Data, where it is EnumList but it is connect to the Data I add before as text
mpibanez_4-1686237953867.pngmpibanez_5-1686238129818.png
And in Data Validity I have:

mpibanez_6-1686247932029.png

I thought that by changing the Valid if  from the Data Colum Text linked to the Sheet I would be able to achieve what I was looking for, but I can't limit it there.
I also failed trying to modify the EnumList to show what is linked with the multi-selection restrictions for the user.

Maybe I should have started by explaining how I linked the data, I apologize. 

 

 

Yes, you should always start by explaining your setup.

So are you trying to limit the number of selections in the Evaluciones[Aguilidad Mental] column? That's where you put the COUNT() valid_if expression.
You can remove that existing valid_if expression, because Ref columns don't need them unless you're wanting to filter the referenced table in some way, which you aren't.
If you do need that in the future, put it in SuggestedValues.


@Marc_Dillon wrote:

If you do need that in the future, put it in SuggestedValues.


Marc, I was trying to filter the table that is referenced. I tried putting it in the suggested values as you said and it worked!! Thank you very much!!

AND(...): You can use the AND function to combine multiple conditions for validating an EnumList column. For example, AND(COUNT([_THIS])>=2, COUNT([_THIS])<=5) ensures that between 2 and 5 items are selected.

COUNT([_THIS])<=5: This expression validates that the number of selected items in the EnumList column is not greater than 5. It restricts the user from selecting more than the defined maximum limit.

Thanks Sirfyaad! 
My problem is that I am working with a text type column. If I see that I can't limit it as I wish, I'll try to modify my data to Enumlist.

Top Labels in this Space