# [đź’¸ 20k sats reward] Check if CartProducts Quantity is bigger than InStock

Hi,

I have a â€śCartâ€ť which contains â€śCartProductsâ€ť. â€śCartProductsâ€ť contains a â€śQuantityâ€ť field (number) and is linked to â€śProductâ€ť data type which contains an â€śInStockâ€ť field (number).

What I want to achieve is look if the the CartProductsâ€™ Quantity > CartProductsâ€™ Productâ€™s InStock.

This can be easily done if we onle deal with one CartProduct, but as a Cart can contain many CartProducts it becomes more difficult.

If I do a search for â€śCartProductâ€ť: Quantity > CartProductâ€™s Productâ€™s InStock that would work but I am not able to access the second part of the equation.

Alternatively I am able to retrieve 2 list of numbers. One containing the Quantities and another containing the InStockâ€™s. But even here I canâ€™t think of a way to compare if one of the Quantities is bigger than the related InStock.

Has anybody an idea on how to tackle this problem?

PS: You get 20k sats on Circle if you help me solve this

Hi there, @mazeâ€¦ I could be off base here, but Iâ€™m wondering if an advanced filter would enable you to create the expression you need. So, you would get rid of the quantity constraint on the search and add the :filtered operator to the end of the search. After you select Advanced for the filter constraint, Iâ€™m wondering if you can construct an expression along the lines of `This CartProduct's Quantity > This CartProduct's Product's InStock`.

Anyway, maybe just something to try, and I hope it helps.

Bestâ€¦
Mike

1 Like

Here the problem is that I am unable to refer to â€śThis CartProducts Product InStockâ€ť after the >.

Also putting it before > does not work.

Thatâ€™s not an advanced filter. When you create the constraint on the filter, you have to scroll to the bottom of the dropdown and select the Advanced option.

1 Like

Awesome this works!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.