Creating APIs‎ > ‎Logic‎ > ‎Rule Types‎ > ‎

findWhere System Method

The findWhere system method returns a filtered, sorted collection. It is common for logic to require searching lists to verify whether or not objects are present, for example:

  • Inclusion. Assure a row is included.
For example, an Employee might have two child collections of languages: spokenLanguage and translatesLanguage. You can ensure that each spoken language has a row for that user / language in spokenLanguage.
  • Exclusion. Assure a row is excluded.
For example, in a Bill of Materials definition, you can ensure that a component is not also the containing part.


The following is used in the allocation example:

    row.paymentCustomer.ordersList,  // input collection
    "row.amount_un_paid > 0",        // filter
    "placed_date a")                 // sort 

Parameters: input collection (often a child accessor, as shown here for payments), filter, and sort.


The findWhere construct queries the input collection from the database and performs an in-memory filter/sort. It is an excellent choice if the input collection is small or is re-used in the transaction (since it leverages the transaction cache). If the input collection is large, use a SQL Select.