Multiple value selection with column type Enumlist using values from reference table

Hi everyone

I am working with appsheet to create a custom app for our customer, here comes a issue

(1) I want to create a column for multiple selection of the product code

(2) Since using the Enumlist column type will require entering dozens of product codes (values) manually, so I ask Gemini if there is a way of doing it efficiently

---------------------------------------------------------- here is the suggestion from Gemini: ---------------------------------------------------------

  • Create Your “Pcodes” Table:
    • As before, create a table with your “PcodeID” (Key) and “Pcode” (Text) columns.
  • Modify Your Main Data Table:
    • Create a column named “PcodesSelected.”
    • Set the column type to EnumList.
    • Crucially, in the “Base type” setting of the EnumList column, set it to Ref, and then set the referenced table to your “Pcodes” table.
    • Add a “Valid if” expression to the “PcodesSelected” column, that equals your Pcodes Table. For example, if your Pcodes table is named “Pcodes”, the “Valid if” expression would be: =Pcodes[PcodeID]

How it (Attempts to) Work:

  • AppSheet will try to present the “Pcode” values from your “Pcodes” table as the options in the EnumList.
  • Users can then select multiple pcodes.

------------------------------------------------------------------------------------End ---------------------------------------------------------------------------------------------

I follow what Gemini suggested,

(1) I set the column type to “Enumlist”, and the base type to “Ref”

(2) In data validity section, I use : Valid If = Ref_pcode[pcode_ID]

where Ref_pcode is my table of reference and pcode_ID is the key of the table “Ref_pcode”

below is what the table “Ref_pcode” looks like

The result was unexpectedly effective, and now I can use this column with the type of “Enumlist” and base type of “Ref” (Ref table = Ref_pcode) for multiple selection using values from the Ref_pcode table

Do anyone has the idea how Appsheet achieve this, and I would like to know if this is a good practice of doing it ?

It seems you created a “dedicated” table to list the “pcodes”. If you are asking if this is a good way to handle the creation of an EnumList column, then NO it is not. You would typically use an already existing table. In your case, based on your description, that sounds like it should be the Products table.

If you were to reconfigure your EnumList table to use the “Products” table as the source and then set the Valid_If to something like Products[Table key column], you will get the same results without the need to create, and maintain, a separate table with the rows keys.

Whether this EnumList approach is the best option or not depends on your goal. If you are simply wanting to assign a list of Products without any other needed details, then it IS what you want.

However, if your need is to select multiple products for something like order placement, where you need to specify the quantity price and sub-total for each product chosen, then this is not the approach you want. You would want a details table - e.g. Order Details - where each row includes a single selected product and then allows entry of quantity and any other associated details for that line item.

Some app creators combine these two - an EnumList for quick selection of line items and then, upon taping save, execute actions that automatically create a row in the Details table for each line item assigning a chosen product. User then fill in the other details afterwards.

I hope this helps!