Skip to main content
List queries accept four main arguments:
  • where filters the results;
  • orderBy defines their order;
  • limit defines the maximum number of results;
  • offset skips the first results.
You can use several arguments in the same query.

Filter results

Add where and specify an operator for each field that you want to filter.
The common operators are: _ilike ignores differences between uppercase and lowercase characters. Combine conditions with _and, _or, or _not.
The site: { name: … } filter uses related data. It selects receivings from the name of their site.

Sort and paginate

This query returns the 50 latest receivings:
To read the next page, add the limit value to offset. Keep the same orderBy for every page. Otherwise, some rows can be repeated or missing. Select a relation like another field. The following query returns a receiving, its supplier, its lines, and the article for each line.
supplier is an alias. It replaces the supplierOrganization name in the response. A nested relation can also have its own where argument.

Trace a lot back to its customer

A supply allocation links a supply to the need it covers. To find the customer of a lot, follow its allocations up to a sales order line. The following query covers a lot that is allocated directly to a sales order line.
When a manufacturing order consumes the lot, the need is a record, not a sales order line. Read it with demandManufacturingOrder, then read the allocations of that order. Use demandTransformationOrder and demandTransfer for transformation orders and transfers.
Add releasedAt: { _isNull: true } at every level. Otherwise, released allocations appear in the result. The depth is explicit: add one more level of supplyAllocations for each manufacturing order, transformation order, or transfer between the lot and the sales order line.

Trace a sales order line down to received lots

Use the user role, including with an API key. Set salesOrderLineId to the line to trace, for example in the GraphQL variables panel:
The query keeps historical links to manufacturing and transformation orders. When a produced lot takes over an order’s allocation, the released order link still reaches its component supplies. releasedAt marks these released links. currentSupply returns active component allocations. Before receipt, they point to purchase lines. A partial receipt adds lot allocations and reduces the remaining purchase quantity. A complete receipt releases the purchase allocation and leaves the received lots. Each lot exposes its stock-row ID, lot number, barcode, expiration date, and shared lot identifier. purchaseHistory keeps purchase lines and their suppliers visible after receipt. It includes released allocations, so it is history, not a quantity to add to currentSupply. receiptSuppliers follows completed direct purchase receipts and receiving documents. It follows the shared lot identifier across stock locations. For legacy lots without an identifier, it follows recorded manual stock moves back to receipts made before the move. For a receiving document, the list uses the suppliers of purchase lines for the received article. The supplier on the document is a fallback when none is found. If several suppliers deliver the same article in one receiving, the list contains all of them: the data does not associate each lot with an individual receiving line. A lot without a known receipt supplier returns an empty list.
The depth is explicit. For another production level, add a componentAllocations selection for manufacturingOrder or transformationOrder, including released order links as at the root. Keep currentSupply for active component allocations. A need with no received lot has no non-null lot in currentSupply; a partially received need can have both lots and purchase lines.

Count results

Use an operation that ends with Aggregate to calculate a value across several records.
Depending on the field type, you can also use sum, avg, min, or max. The server calculates the result without returning every row.
The custom tables and fields in your space use the same filters and relations.