[đź’¸ 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?

Thanks in advance. :raised_hands:

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

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.