"Contains" condition applied to a relational property

Hello,
Do you know if there’s a way to set up a display condition for an input field component within a form, based on the content of a relational property located in the same form (show component “quantity” if “Product sold” contains “Product 1”) ?
Currently the option is not “contains” but only “is empty/not empty”, and this is not enough as an order can contain different products (and I would need 1 type of product = 1 “quantity” input field component).
Thanks !

If you use a Query column instead of a relation, you can apply filters to get a specific match, and then use the query empty/not empty state as the filter.

It seems like I can’t make a choice component over a query column in a form.
Use case is : I want to add a new sell → I have a form to do it and within I have a choice component to submit the different type of products. And when I select a type of product, the associated “Quantity” input field will appear. So, if a product is not selected in the list, the associated “Quantity” input field will not appear. Hope this is clear enough !

In other words, how could I do this on Glide ?

Your relation/query won’t be enough for this use case, you must bring the product name back via a joined list to be able to use it for conditions.

However, shouldn’t you structure your data in a way that each item should be on its own row, with its own quantity? It looks like you’re trying to have multiple quantities columns for different products on the same row.

1 Like

You can build a query and turn it via join list/split list into a column that can be used as a choice input.

Can you build a query that resolves to the items in your drop down/choice?

1 Like

I see, I will try this solution thanks.

Yes this is how I structured my datas : each product has its own row and quantity column !

OK thanks I try this and keep you updated. And no it seems that query column can’t be linked to a choice component.

Update : i set up a joined list as a display condition for the “quantity” input field, but to have an updated joined list (that display all the products included in the order), I have to make a first form telling what products are included the order, and then the submit button goes to a second form to submit the quantities of each ordered product, with the appropriate quantity input fields (based on the joined list).
The question is : is it possible to link a form to another ? Like the submitted inputs in the second form will feed the row created in the first form
Or maybe this is not the good way to do what I intend to !

It does sound like there’s something wrong with your flow. Can you explain again to me why don’t you have each product on their own row but as different columns on the same row?

So, mainly, I have one table “Products” where every product has its own row, and one table “order”, where there is, among others, one relation column X, that lists all the products from the"products" table, in order to chose which are contained in the order (hope it’s clear enough!). Here, yes, different products are in the same row but because they are in the same order.

And I’m using the “order” table to generate a form to submit a new order → one input field is thus a dropdown based one the relation column X, to chose what products are contained in the order.

The problem is to submit the quantities for each ordered product. I don’t want to display in the order form, a quantity input field of the product A if product A is not contained in the order.

Maybe I can in fact, make several “sub-orders” in one form to compose one order ? As the quantity of the products will be the sum of the “sub-orders” for one product ?

Sooo, update I think I made it :

  • On page “Orders”, you have a button “Add an order”
  • On click : 1 row is created in the “Orders” table + opens a page “Add an order”
  • On page “Add an order” you have : 1 text input field to name the order + 1 button for each product “add product X”
  • On click of each “add product X” : increment number +1 in the appropriate quantity column in the “Order product”
    And that’s it ! And then a quick button to set the “order name” column value (with the text input field) + close the page “Add an order” etc

That’s a bit bumpy but this works

Update 2 : This doesn’t work, as the increment number action doesn’t start from zero but from the previous number (even if I set up a “0” value by default)

Wouldn’t it start from 0 because you have a new row and the quantity columns are empty at that point?

That’s what I thought but no it starts from the previous count !

Can you record a video of the behaviour using Loom.com? Thank you.

Hello, I just delete everything because I tried too much things and needed a fresh start !
I’m also still trying to figure out what is my actual issue because maybe i got it wrong : my wish is to be able to submit a new order to track orders for a shop. An order can have different items (with different quantities) and an item can be in different orders. So I made a many-to-many relationship (with a third table) which works, but the actual problem is how can I have a choice component (or collection?) that display all the available items (from the products table), and how to link every added items to a single order. I’m currently reading this post about many to many relationship.
Hope this is not confusing, thanks for the help !