Retrieve documents for printing¶
This operation loads the documents belonging to a print-control batch, resolved against the physical printer and bin routing tables, in one of two shapes selected by PrintType: per-document (ByDocSeq), for iterating and printing each document individually in sort order, or grouped (ByPrintGroup), for print jobs that treat an entire print group as a single unit. Both shapes are produced by the same clsXDocumentCollection retrieve path and share the same join and parameters — they differ only in the SQL text selected and the shape of the result set.
| Field | Value |
|---|---|
| Operation ID | OP-005 |
| Trigger | Caller invokes clsXDocumentCollection.GetXDocumentCollection(inXPrintControlSeqNum, inPrinterID, inPrintType) |
| Inputs | XPrintControlSeqNum, PrinterID, PrintType (ByDocSeq or ByPrintGroup) |
| Outputs | Collection of clsXDocument, each carrying resolved XBinNumber and PrinterNetworkName |
| Primary components | clsXDocumentCollection.BeforeRetrieve, clsXDocumentCollection.AfterRetrieve |
| Entry point | Services\SAIF.Services.Printing.Remote\clsXDocumentCollection.vb |
Steps¶
- Select the retrieval shape. Caller invokes
GetXDocumentCollection(...)withPrintType = ByDocSeq(per-document) orPrintType = ByPrintGroup(grouped).BeforeRetrievebinds:XPrintControlSeqNumand:PrinterIDregardless of which shape is selected. - Per-document retrieval (
ByDocSeq).BeforeRetrievesets the request's SQL text toMyCriteria.RetrieveSQL, executing SQL-011: a three-table join acrossXDOCUMENT,XPRINTER_BIN, andXPRINTER(XDOCUMENT, XPRINTER_BIN, XPRINTER) that resolves the physical bin number (BIN_NUM) and printer network name (NETWORK_NAME) for the given printer and batch, ordered by the ten sort-value columns. - Grouped retrieval (
ByPrintGroup).BeforeRetrievesets the request's SQL text toMyCriteria.RetrievePrintSQL, executing SQL-012: aSELECT DISTINCTvariant of the same join, keyed onPRINT_GROUP_TEXTwith literal placeholder values ('n/a', fixedCopiesCount = 1) standing in for per-document columns that are not meaningful at group level, ordered byPRINT_GROUP_TEXT. - Load the result.
AfterRetrieveiterates theIDataReaderand constructs aclsXDocumentper row viaLoad(), adding each to the collection — for the grouped shape, the result drives "print as one group" scenarios rather than per-document iteration.*
Process flow¶
The following diagram visualizes the two retrieval shapes sharing the same join.
flowchart TD
Start([Caller calls GetXDocumentCollection<br>with XPrintControlSeqNum, PrinterID, PrintType]) --> Which{PrintType?}
Which -->|ByDocSeq| PerDoc[Join XDOCUMENT, XPRINTER_BIN, XPRINTER<br>resolve BinNum + NetworkName<br>order by 10 sort values]
Which -->|ByPrintGroup| Grouped[SELECT DISTINCT on same join<br>keyed on PrintGroupText<br>literal placeholders for per-doc columns]
PerDoc --> Load[Load rows into<br>clsXDocument collection]
Grouped --> Load
Load --> End([Collection returned to caller])
Failure and edge-case behavior¶
- Both shapes require a matching
XPRINTER_BINrow for the document'sXBIN_TYPE_CODEand the givenPrinterID— a document whose bin type has no configured route for that printer is excluded from either result set (inner join semantics). - The grouped shape's placeholder values (
'n/a', fixedCopiesCount = 1) mean per-document fields are not usable from a grouped result; callers needing per-document detail must useByDocSeqinstead. PrintTypedefaults toByDocSeqon the criteria class when not explicitly specified via the three-argument overload.
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.
Related documentation¶
Sources¶
Services\SAIF.Services.Printing.Remote\clsXDocumentCollection.vb