Using a column_a with EnumList type as the values to choose from to column_b with EnumList type as well

Here’s the situation.
I have Requests appsheet db which has a requests form where users will input the details of their requests.

I also have data_storage appsheet db which contains cuisine_type Text column and food_name EnumList column. Each record in cuisine_type has a corresponding list of values in food_name (e.g., japanese → ramen, soba, okonomiyaki, tsukemen, yakisoba).

Requests also have the same columns, cuisine_type (Enums), and food_name (EnumList).

My goal is when the users fill out Requests Form and choose “japanese” for their cuisine type, the dropdown for food_name will contain ramen, soba, okonomiyaki, tsukemen, yakisobaas choices in which the user can choose more than one.

______

Here’s what I tried so far:

For Requests.cuisine_type I just add in valid ifdata_storage[cuisine_type] then I get dropdown list of values.

For Requests.food_name I tried Select(data_storage[cuisine_type], [_THISROW].[cuisine_type] = [cuisine_type]but instead of getting a list of values , the whole list of food was combined into a single value.

1 Like

It seems this expression should be

Select(data_storage[food_name], [_THISROW].[cuisine_type] = [cuisine_type]

Make sure that the Base Type of Request.food_name is Text - so an EnumList with a base type of Text.

It might also be helpful to review this article below:
Dependent Dropdowns

Since food_name is an enumlist column an expression in the format SELECT(data_storage[food_name]…) creates a list of lists. To flatten this list of lists into a list, please wrap the expression with a SPLIT() function.
Please try an expression something like below:

SPLIT(SELECT(data_storage[food_name], [_THISROW].[cuisine_type] = [cuisine_type]), “,”)

1 Like

Hello, I’ve tried this and it worked on the form; I was able to choose multiple values for Requests.food_name.

However, when the data was stored in Requests.food_name, it was a single value instead of a list of values.

Is the Requests.food_name column also of enumlist type?

In my testing it works correctly.

Also what you mean by single value? Do you mean just ramen or just soba or ramen, soba as a list in single cell stored in the backend?

My testing shows , the user can select all or lesser options and all get stored as per selection.
Form view:

Detail view

1 Like

When looking at the actual appsheet database, it looks like this:

The record at the top is what I want, but the the record at the bottom is what I’m getting.

Although, truth be told, I’m not actually sure if it will make a difference in the long run. I just want it to be consistent in case I have to update a feature relevant to this in the future.

Could you share the configuration of this column?

1 Like

How do I share it?

It should be just
EnumList
with Text as Base

Please share the valid_if expression for it?

1 Like

Please clarify what you mean by this. An example of how the values were stored would help.

In an EnumList column, multiple selected values will be stored as a single comma separated string in the datasource. It is stored in a certain format by AppSheet to identify it as a List - specifically between each value is space-comma-space like so “Value1 , Value2 , Value3”. This is how AppSheet will store 3 values selected in an EnumList.

I hope this helps!

2 Likes