How to use CHOICE reference filter with Reference List?

I have a Products Table.
I have a Supplier table. Each supplier has a reference list of products he can deliver
I have an invoice table
I have an invoice products table

At the invoice table I select a supplier
At the invoice products table I want to select ONLY products that supplier delivers.

So at the Invoice Products table, I have a column that references the Product table.

I tried “choice.productname in supplier.products”

but I get error messages

Hey @Rogerio_Penna !

You’ll need a dedicated column in the Invoice table that pulls the list of Products for the selected Client. This could be hidden from view! Conditions are not full formulas so they don’t have reference-lookups unfortunately. Once the column is added, use the condition choice.id in $Supplier_Products and the dropdown should show the correct Products.

Example is set up here: Community #9425 - Grist

Since you already have the Supplier reference column, you can quickly add a new column looking up the Products column from the Supplier table.

Then add the dropdown condition choice.id in $Supplier_Products to the Product column. This will update the dropdown to only show Products for that Supplier.

Hide the Supplier_Products column from view and you’ll be set!

Thanks!

1 Like

Thanks Natalie. Only problem is that I have to force the user to first insert a quantity or something else, for Grist to create the record referencing the purchase (with the supplier). Otherwise there is no supplier in that row to filter that product list right?

Is there any creative solution besides this? Maybe an action button “add product”?

You could probably use an action button to create the record! Another, simpler way is to add a toggle column to the table. It’s only role is to create the record. I’ve done this before for the same scenario where you are creating a record and want the dropdown filtered to the reference (which is filled in automatically with a linked widget). In the screenshot, you can see you just toggle the switch to create the record. Then, the Enroller Name dropdown would be filtered based on hidden columns that are automatically populating based on widget linking.

1 Like