Package net.pricefx.formulaengine.scripting.queryapi


package net.pricefx.formulaengine.scripting.queryapi
The Query API, the unified Groovy API for reading data from Pricefx. A query is written as a pipeline: a source stage reads a Pricefx table, chained PipelineStage transformations (joins, filters, aggregations, sorting) reshape the data, and the stream method executes the query and fetches the result rows.

Entry point: obtained through api.queryApi(); see PublicGroovyAPI.queryApi(). On the returned QueryApi, QueryApi.tables() lists the available source tables (master data, price lists, price grids, rebate data, Analytics Data Sources and Datamarts), QueryApi.exprs(), QueryApi.orders() and QueryApi.groups() provide the Expression, ordering and grouping building blocks, and QueryApi.source(Tables.Table) starts the pipeline.

Contrary to declarative SQL, a query describes a sequence of data transformation stages. Joins, aggregations and window functions (WindowFunction) have standard SQL equivalents. Output columns are referred to by their Selectable alias; an unnamed Expression receives an alias with as(String). The query runs against the database only when stream is called. The typed table and column descriptors returned by Tables live in the net.pricefx.formulaengine.scripting.queryapi.tables subpackage. The Query API is available in all logics and is the recommended way to read data in new logic, replacing deprecated general purpose query functions such as api.find.