How to check if a list of things have the same value

Hello,

I have a item called Ordered_wrapper which has a field called orders which is a list of Order-product.

The Order-product has a field option set called order_experience_status with two different fields supposing Confirmed and Canceled.

Therefore, I am trying to check if all Ordered_wrapper - order list: Order-producthave all of them the same status like Confirmed as displayed.

How would I do it?

I made the query the list to check if it contains “Confirmed” but it looks not make sense because it checks for at least one item in the list. But I need that all of the Order-products to be set to the same value.

image

:slight_smile:

Try using the :filtered operator and specify the properties to filter by.
This will return a list of filtered things and you can run an operation on it.

The Make changes to a list of things action might help you change a property on all items of this filtered list.

Thank you for your reply. Based in what I know filtering will retrive all items that is true within the list other than checking if all of the items are same.

In a sql query I would count(*) then check if all of them are the option I choose.

Yes, it will condense the list to only the things that match the conditions you set.

I followed this approach but it is kind of brute-force approach. Because you have to filter filter-by-field. The query is pretty slow but it works.

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