Postman collection
Stock Read

pixiShopLinkGetItemsStockRange

Returns the exportable available stock quantity and minimum stock of items, paged by item key, for synchronising shop stock levels.

Returns one row per item with its available quantity for a stock export to a shop. The behaviour depends on the settings OldStockExport, StockExportUsePhysicalStock, ReservePrepaymentOrders and ExportAvailableStock_WhenReservationsAreEnabled. A missing setting counts as 0.

Parameter defaults: FromItemKey NULL becomes 0, RowCount NULL becomes 1000, ExcludeZeros NULL becomes 0.

Standard mode (OldStockExport is not 1):

  • Only items with ItemKey >= FromItemKey are read. At most RowCount rows are returned, sorted by ItemKey ascending.
  • AvailableQty is the precomputed export stock of the item (ItemQtyIBIExportStock_locations) minus a deduction:
    • The open order line quantity (ItemQtyOpenOrderLines) if reservations are disabled, or if they are enabled and ExportAvailableStock_WhenReservationsAreEnabled = 1. This applies only if StockExportUsePhysicalStock = 0 and the item is not a bundle.
    • The open reservation quantity (ItemQtyOpenReservations) if reservations are enabled and the other setting is not 1. This also applies only if StockExportUsePhysicalStock = 0 and the item is not a bundle.
    • Nothing in all other cases: physical stock is used, or the item is a bundle.
  • With ExcludeZeros = 1, only items with AvailableQty > 0 are returned.
  • With ExcludeZeros = 0, all items in the range are returned and negative quantities are set to 0.

Old mode (OldStockExport = 1):

  • Returns ItemNrInt, Quantity as AvailableQty (NULL becomes 0) and MinStockQty for all items.
  • There is no ItemKey column, no paging and no sort order.
  • With ExcludeZeros = 1, items with a quantity of 0 are left out.

Paging: in standard mode, call again with FromItemKey = last returned ItemKey + 1 until fewer than RowCount rows come back.

Notes

  • All reads use NOLOCK, so results may include uncommitted data.
  • The quantities come from precomputed columns of Items (ItemQtyIBIExportStock_locations, ItemQtyOpenOrderLines, ItemQtyOpenReservations). Which stock locations or bins they include is defined elsewhere and is not visible in this procedure.
  • Old mode differences:
    • FromItemKey and RowCount are ignored and all items are returned in one call.
    • ItemKey is missing from the result.
    • With ExcludeZeros = 1, negative quantities are still returned.
    • With ExcludeZeros = 0, negative quantities are not set to 0.
  • In standard mode with ExcludeZeros = 1, items whose computed quantity is NULL are also left out.
  • RowCount = 0 returns no rows. A negative value causes a SQL error from TOP.
  • The value of OldStockExport is converted to int. A non-numeric setting value would cause a conversion error.
  • The large commented-out legacy block in the source has no effect.

Tables used

Items · Read Settings · Read
SQL object:
dbo.pipiShopLinkGetItemsStockRange
Updated at 2026-10-30