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

neardj
New Member

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

Solved Solved
0 35 1,785
1 ACCEPTED SOLUTION

The fix I offered previously:

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

View solution in original post

35 REPLIES 35

Steve
Platinum 4
Platinum 4

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)
)

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

Please post a screenshot of the error message.

So there!

Weird!

What if you use this instead?

LIST() + T_ROSA[ID_CICLIST]

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.

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
)

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.

Try this, the extra ( is before [IDSQUADRA]

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
)

With this formula the error is:

Unable to find column โ€˜THISROWโ€™

Whoops! That was a typo. Should be _THISROW.

I just corret this. But the new error is:

Unable to find column โ€˜IDSQUADRA] [_THISROWโ€™

Ack! Another typo. Corrected above.

Now your formula is correct but the limit max 8 choise donโ€™t work. Now I can see the items but I canโ€™t select nothing.

On Valid If I have insert your suggestion:

AND(
  ISBLANK([_THIS] - T_ROSA[ID_CICLISTA]),
  (COUNT([_THIS]) <= 8)
)

@Steve your suggestion works if I change the โ€œinput modeโ€ to โ€œDropdownโ€. If I use โ€œbatteriesโ€ or โ€œbuttonsโ€ the value is not colored. So it is not clear if it has been selected. Why?

@Steve Do you have an idea for this problem?

I donโ€™t understand the problem. Please post a screenshot.

Iโ€™m sorry.
I hope to make myself understood better with pictures.

Before inserting the changes you advised me when the user selected his choice, the button was colored blue:

After entering the changes you recommended, the screen looks like this:

The selected cyclist / button (1) turns dark black while the unselected cyclist (2) remains black. For the user it becomes really difficult to understand who has selected and who has not.

Even if I change the mode to โ€œlightโ€ it changes little. The selected button becomes dark gray and the unselected one slightly lighter gray.

Do you think it could be a bug?

Yes, it looks like a bug to me.

Even with the unclear coloring, do the selections work as desired? Do multiple selections get saved to your spreadsheet?

Yes the selection work and I find the data on spreadsheet. How can I report the bug?

Send email to support@appsheet.com.

Thank you so much for your immense help.

Hi Steve,
sorry if i disturb you again.
If I wanted to add to the formula you suggested also the possibility of excluding from the list the cyclists who do not have an empty field in the T_ROSA table, in the โ€œFINO_ALโ€ column, which formula should I add?
I tried to insert another condition to the โ€œORโ€ function for example ISNOTBLANK ([_ THISROW]. [FINO_AL] but it doesnโ€™t function.
Always thank you very much

Please start a new topic for this question and provide a complete description of the problem.

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 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?

Yes it is.

neardj
New Member

@Steve I realized that by selecting โ€œdropdownโ€ first I see the 30 cyclists of the selected team but after the last value I also see another 40 cyclists who are part of other teams not selected. With โ€œbuttonsโ€ and โ€œstack downโ€ it does not happen.

Hmmmโ€ฆ Try unchecking Auto-complete other values in the EnumList columnโ€™s configuration.

Thank you! Now I only see the cyclists of the selected team.

Top Labels in this Space