Exporting Stock Data for an Order

Last updated: May 19, 2026

This article describes how to generate a report of lot code and date code data for the stock lots received from a given Ordered Cart.

Navigate to: https://platform.cofactr.com/reporting/sql

Note: The SQL Explorer feature is not included with all Cofactr plans. Please contact success@cofactr.com to discuss upgrades to a plan that includes SQL Explorer if you do not already have access.

Copy and paste the following query into the query field:

select
  stock_lot.lot_id as cofactr_lot_id,
  stock_lot.quantity,
  stock_lot.date_code,
  stock_lot.mfg_lot_code,
  stock_lot.country_of_origin
from
  stock_lot
left join purchase_order_line on stock_lot.purchase_order_line_id = purchase_order_line.id
left join requisition_line on purchase_order_line.purchase_request_id = requisition_line.id
left join requisition on requisition_line.requisition_id = requisition.id
where
  stock_lot.is_expected is false
  and stock_lot.quantity > 0
  and requisition.code = 'ORDER CODE'

Replace ORDER CODE with the order code for the order that you would like to query data for. This will start with RQ and can be found in the Order Code column of the Ordered Carts view or the top of an individual Ordered Cart above the cart name.

Click Run Query

If you have a large library of BOMs, it may take a minute or two for the data to load.

Optionally, click Export to save the report as a CSV or Excel File