api.find()

The method api.find() will be deprecated in the future releases. You might consider changing implementation to the QueryAPI whenever it is possible. It is already possible for the following tables.

Code

Type

P

Product

PX

ProductExtension

C

Customer

CX

CustomerExtension

S

Seller

SX

SellerExtension

LTV

LookupTableValue

MLTVx

MatrixLookupTableValue

Deprecated Usage

Groovy
def filter = [
        Filter.equal("Active", "Yes"),
        Filter.equal("BusinessUnit", "BU01"),
]
def products = api.find("P", 0, 10, "ProductGroup,-IntroduceDate", ["sku", "label", "ProductGroup", "unitOfMeasure"], *filter)

QueryApi Usage

Groovy
def qapi = api.queryApi()
def exprs = qapi.exprs()
def orders = qapi.orders()

def p = qapi.tables().products()

def products = qapi.source(p, [
        p.sku(),
        p.label,
        p.ProductGroup,
        p.unitOfMeasure(),
], exprs.and(
        p.Active.equal("Yes")
        p.BusinessUnit.equal("BU01")
))
        .sortBy { cols ->
            [
                    orders.ascNullsFirst(cols.ProductGroup),
                    orders.descNullsFirst(cols.IntroduceDate),
            ]
        }
        .take(10)
        .stream { it.collect() }

See Also