Is it possible to limit number of options chosen from an EnumList with base type "Ref"?

Hi,
I am developing my first App with AppSheet.
I created an “EnumList” column that uses “Ref” as the “base type”.
I tried to do as suggested in this topic: https://community.appsheet.com/t/is-it-possible-to-limit-number-of-options-cho/2789/2?u=neardj

but in my case it doesn’t work.
On “Valid IF” I have this formula: T_ROSA [ID_CICLIST] (which I use to retrieve the data for the EnumList) how can I also add the formula: COUNT ([_ THIS]) <= 8 ? (I want to limit max 8 choise)

Finally I wanted to ask you if you think it is possible that each value chosen by the EnumList goes on a new line instead of in a list delimited by a separator.

Thank you
Neardj

I’ve not tried this, but it might work:

In Suggested values, use this:

T_ROSA[ID_CICLIST]

In Valid If, use this:

AND(
  ISBLANK([_THIS] - T_ROSA[ID_CICLIST]),
  (COUNT([_THIS]) <= 8)
)
1 Like

Thank you for your reply.
I’ve tried it but don’t work.
I see this error:

Column Name ‘ID_CICLISTA’ in Schema ‘T_INVIO_FORMAZIONE_Schema’ of Column Type ‘EnumList’ has invalid ‘Suggested Values’ of ‘=T_ROSA[ID_CICLISTA]’. The type of the Suggested Values does not match the column type.

Make sure the ID_CICLISTA column is of type EnumList with base type Ref and source table of T_ROSA.

Yes. I attached you the screenshot.
ref|507x500

1 Like

Please post a screenshot of the error message.

So there!

1 Like

Weird!

What if you use this instead?

LIST() + T_ROSA[ID_CICLIST]

Wouldn’t the Suggest Values be the EnumLists not the items inside of it if you use T_ROSA[ID_CICLIST]? So the suggested values are EnumLists of References not References?

I tried. But with this formula I see all the values ​​of the column and not only those of the reference item are filtered.
If I use T_ROSA [ID_CICLISTA] I only see the elements I need.

I use T_ROSA [ID_CICLISTA] because I only want to see some filtered values.

OH I misread, I thought your screenshot was the T_ROSA table. Is ID_CICLISTA the key for T_ROSA?

Sounds like you had been benefiting from the magic dependent dropdown feature. Complex Valid If expressions cannot be used with dependent dropdown, so we’ll have to recreate the functionality, which is doable.

Try this as the Suggested values expression:

SELECT(
  T_ROSA[ID_CICLIST],
  OR(
    ISBLANK([THISROW].[IDSQUADRA]),
    ([IDSQUADRA] = [_THISROW].[IDSQUADRA]
  ),
  TRUE
)
1 Like

I tried it. I have this error:
Expression ‘SELECT( T_ROSA[ID_CICLISTA], OR( ISBLANK([THISROW].[IDSQUADRA]), ([IDSQUADRA] = [_THISROW].[IDSQUADRA] ), TRUE )’ could not be parsed due to exception: Number of opened and closed parentheses does not match.

Yes it is.

Try this, the extra ( is before [IDSQUADRA]

1 Like

Thanks. I have tried it. Now I have this error:

Column Name ‘ID_CICLISTA’ in Schema ‘T_INVIO_FORMAZIONE_Schema’ of Column Type ‘EnumList’ has invalid ‘Suggested Values’ of ‘=SELECT( T_ROSA[ID_CICLISTA], OR( ISBLANK([_THISROW].[IDSQUADRA]), [IDSQUADRA] = [_THISROW].[IDSQUADRA] ), TRUE )’. The type of the Suggested Values does not match the column type.

The fix I offered previously:

LIST()
+ SELECT(
  T_ROSA[ID_CICLIST],
  OR(
    ISBLANK([_THISROW].[IDSQUADRA]),
    ([IDSQUADRA] = [_THISROW].[IDSQUADRA])
  ),
  TRUE
)
2 Likes

With this formula the error is:

Unable to find column ‘THISROW’

1 Like

Whoops! That was a typo. Should be _THISROW.