Efficientl expression to search for things where thing has 2 related things

I need help building a search expression.

Example:

  • A thing, “Order”, has field “Line Items” which is a list (a list of “Line Item” things)

I want a list of all Orders that have 2 Line Items.

What’s the expression?

As far as I can tell, there’s no way to build an expression that is Do a search for Orders where Line Items:count is 2. The options for constraints for a field that allows a list are limited to “empty/not empty” or “contains / doesn’t contain”

Thanks!

Ian,

Correct. Such constraints dont exist. Best workaround (likely the best although it may not be based on use case) is to store the number of order items as a seperate number field on the order dataset. Consider using a db trigger to update this new field whenever a order’s line items are added or removed.

2 Likes

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