Postman collection
Reports Read

pixiReportScanInPerTimeQuant

Returns the number of scan-ins (order history status `EIN`) per time slot of a given length in hours within a date range, optionally for one shop.

Builds a time series of scan-in counts for dashboards.

  1. Defaults are applied: if startDateTime is NULL, the start of the current day (midnight) is used; if endDateTime is NULL, the current date and time is used; if timePeriod is passed as NULL, it becomes 1 (the declared default when the parameter is omitted is 2).
  2. The range from startDateTime to endDateTime is split into consecutive slots of timePeriod hours (fractions such as 0.5 for 30 minutes are possible). The last slot is cut off at endDateTime.
  3. For each slot, the rows in orderHistory with status = 'EIN' and a StatusChangeDate between slot start and slot end (both inclusive) are counted.
  4. If shopID is empty or NULL, all shops are counted; otherwise only history rows of that shop.
  5. One row per slot is returned in chronological order, including slots with a count of 0.

If startDateTime is not before endDateTime, the result set is empty.

Notes

  • orderHistory is read WITH (NOLOCK); counts may include uncommitted data.
  • Because BETWEEN includes both boundaries, a history entry exactly on a slot boundary is counted in two adjacent slots.
  • startTimePeriod and endTimePeriod are strings produced by CONVERT(VARCHAR, …) with the default style (e.g. Jan 15 2024 8:00AM); seconds are not shown and the format depends on the server language. Parse them accordingly or compute the slot times on the client side.
  • The shopID column echoes the passed parameter, so it is empty (or NULL) when all shops are counted.
  • Pitfall: a timePeriod of 0 or a negative value makes the loop never end; always pass a positive value.
  • Large ranges with small slots run one count query per slot and can be slow.

Tables used

orderHistory · Read
SQL object:
dbo.pipiReportScanInPerTimeQuant
Updated at 2026-10-30