---
title: clsXDocumentCollection
summary: API reference for clsXDocumentCollection.
status: draft
owner: <owner>
last_reviewed: 2026-07-24
library: SAIF.Services.Printing.Remote
reference_type: package
---

# clsXDocumentCollection

`clsXDocumentCollection` is a collection of `clsXDocument` print job documents. It extends `clsBusinessCollectionBase` and drives batch/group printing logic via the `PrintType` enum. On retrieve, it joins `XDOCUMENT`, `XPRINTER_BIN`, and `XPRINTER` to resolve physical bin numbers and printer network names. It also defines the batch-level delete operation that removes all documents for a given print-control batch.

## Purpose
- Retrieve ordered documents for a print-control batch with physical printer/bin routing resolved.
- Support two printing modes: per-document (`ByDocSeq`) via [SQL-011](../../sql/SQL-011-saif-services-printing-remote.md) and grouped (`ByPrintGroup`) via [SQL-012](../../sql/SQL-012-saif-services-printing-remote.md).
- Delete all documents belonging to a print-control batch via [SQL-021](../../sql/SQL-021-saif-services-printing-remote.md).

## Context
- Namespace: `SAIF.Services.Printing.Remote`
- Assembly/package: `SAIF.BOF.Services.Printing.Remote`
- Base class: `clsBusinessCollectionBase` (from `SAIF.BOF.Framework`/`SAIF.BOF.Business`)

## Public members

| Member | Signature | Purpose |
| --- | --- | --- |
| `GetXDocumentCollection` | `Public Shared Function GetXDocumentCollection(inSeqNum As Decimal, inPrinterID As String) As clsXDocumentCollection`* | Factory method — retrieves all documents for a batch, joined to printer/bin routing.* |
| `Criteria` (nested class) | `Public Class Criteria Implements IBusinessCriteria` | Holds SQL: `RetrieveSQL` ([SQL-011](../../sql/SQL-011-saif-services-printing-remote.md)), `RetrievePrintSQL` ([SQL-012](../../sql/SQL-012-saif-services-printing-remote.md), supplemental non-interface property), `DeleteSQL` ([SQL-021](../../sql/SQL-021-saif-services-printing-remote.md)); `InsertSQL`, `UpdateSQL` throw (empty). |
| `Criteria.PrintType` | `Public Property PrintType As PrintType`* | Controls which SQL is executed: `ByDocSeq` (SQL-011, per-document) or `ByPrintGroup` (SQL-012, grouped).* |
| `Criteria.RetrievePrintSQL` | `Public Property RetrievePrintSQL As String` | Supplemental property — not part of `IBusinessCriteria`. Returns [SQL-012](../../sql/SQL-012-saif-services-printing-remote.md) text for `ByPrintGroup` mode.* |

## Behavioral notes
- `BeforeRetrieve` selects between `RetrieveSQL` and `RetrievePrintSQL` based on `Criteria.PrintType`.*
- Both retrieval paths bind the same two parameters: `:XPrintControlSeqNum` and `:PrinterID`.
- `AfterRetrieve` iterates `IDataReader`, loading each document via `Load()`/`Fill()`.*
- `AfterDelete` checks `RowsAffected <> 1` per [BR-001](../../business-rules.md#br-001-row-count-contention-check). However, no `BeforeDelete` override exists in this class — execution of [SQL-021](../../sql/SQL-021-saif-services-printing-remote.md) depends on undocumented base-class default wiring.**
- `InsertSQL` unconditionally throws — batch-level insert is not supported; use individual `clsXDocument` instances for insert.*

## Constraints and usage notes
- Retrieve requires both `XPrintControlSeqNum` and `PrinterID` — printer routing cannot be resolved without a specific printer ID.
- `ByPrintGroup` mode collapses per-document rows to distinct `PRINT_GROUP_TEXT` values with literal placeholder values for per-document columns not relevant to group-level printing.*

> **Note:** Statements marked with `*` were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with `**` could not be confirmed; treat as unknown until verified.

## Sources
- `Services\SAIF.Services.Printing.Remote\clsXDocumentCollection.vb`
