Data type with 2 data fields both number

Hi All, I am quite stuck and I don´t know why.

A plain and simple thing:

I have a Data Type (Produkt ) with 2 data fields (inventory & minimum inventory) both are written in the database.
Now I want to show the number of products where the “inventory” < “minimum inventory”
So I tried it like this: Do a search for Products :count and in the constrain I tried the following; inventory < Parent Group product’s minimum inventory but I get always 0
please advise how to get only the number of products with inventory < minimum inventory.

thanks in advanced
RG
Vik

Hi there,

Instead of ‘Parent Group’ you’ll instead want to refer to the same thing that you’re referring to for the inventory value, like this:

Thing's Inventory < Thing's Minimum Inventory

Now I want to show the number of products where the “inventory” < “minimum inventory

It’s not possible to do this this kind of simple database query in Bubble…

The simplest workaround is to add an additional yes/no field on the Product datatype, and set that via a database trigger whenever the Inventory goes below the Minimum Inventory, and then use that field in the search constraint.

Alternatively, if you only have a handful of Products, and don’t need to worry about scalability, you can do it client-side using an advanced filter.

You’re right, I should have checked before posting!

1 Like