Docs‎ > ‎API Creator‎ > ‎Specify your Business Rules‎ > ‎

findWhere

Returns a filtered, sorted collection.

Example

The following is used in the allocation example:
 SysLogic.findWhere(
    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
sort

Performance

This 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)
  • It is a poor choice if the input collection is very large.  In such cases, use a SQL Select.