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

# clsXDocument

`clsXDocument` represents a single print job document linked to a print-control batch (`clsXPrintControl`) via `XPrintControlSeqNum`. It extends `clsBusinessBase` and inserts rows into `XDOCUMENT` with routing metadata (bin type, sort values), document type, email/fax routing, index text, print group label, and duplex code. New instances default `XBinTypeCode = "AUTO"` and `CopiesCount = 1` per [BR-005](../../business-rules.md#br-005-default-bin-type-on-document-creation).

## Purpose
- Enqueue a print job document into `XDOCUMENT` linked to a parent print-control batch.
- Carry routing metadata (`XBinTypeCode`, sort values, `PrintGroupText`) used for sequencing and grouping print jobs.

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

## Public members

| Member | Signature | Purpose |
| --- | --- | --- |
| `XDocumentSeqNum` | `Public Property XDocumentSeqNum As Decimal` | Primary key; generated via `GetNextSeqNum("XDOCUMENT_SEQ")` in `Create()`. |
| `XPrintControlSeqNum` | `Public Property XPrintControlSeqNum As Decimal` | FK to parent `XPRINT_CONTROL` batch header. |
| `CopiesCount` | `Public Property CopiesCount As Decimal` | Number of copies to print; defaults to `1` in `Create()` per [BR-005](../../business-rules.md#br-005-default-bin-type-on-document-creation). |
| `FileName` | `Public Property FileName As String` | Print job file name. Max length 120.* |
| `DocumentTypeCode` | `Public Property DocumentTypeCode As SmartString` | Document type code. Max length 5.* |
| `EmailAddress` | `Public Property EmailAddress As SmartString` | Email routing address. Max length 60.* |
| `FaxNum` | `Public Property FaxNum As SmartString` | Fax routing number. Max length 60.* |
| `IdxContentsText` | `Public Property IdxContentsText As SmartString` | Indexed contents/imaging text. Max length 2000.* |
| `XBinTypeCode` | `Public Property XBinTypeCode As SmartString` | Bin routing type code; defaults to `"AUTO"` in `Create()` per [BR-005](../../business-rules.md#br-005-default-bin-type-on-document-creation). Max length 5. |
| `PrintGroupText` | `Public Property PrintGroupText As String` | Print group label; used to collapse per-document rows for `ByPrintGroup` mode. Max length 60.* |
| `DuplexCode` | `Public Property DuplexCode As String` | Duplex code stored as 5-character string.* |
| `StartValue` | `Public Property StartValue As SmartString` | Start-of-document marker. Max length 120.* |
| `Sort0Value`–`Sort9Value` | `Public Property Sort0Value As SmartString` (×10) | Ten generic sort/grouping columns for print sequencing. Max length 120 each.* |
| `Criteria` (nested class) | `Public Class Criteria Implements IBusinessCriteria` | Holds SQL text: `InsertSQL` ([SQL-006](../../sql/SQL-006-saif-services-printing-remote.md)); `CreateSQL`, `RetrieveSQL`, `UpdateSQL`, `DeleteSQL` all unconditionally throw `ApplicationException` (empty/dead). |

## Behavioral notes
- `Create()` sets `XDocumentSeqNum = GetNextSeqNum("XDOCUMENT_SEQ")`, `XBinTypeCode = "AUTO"`, and `CopiesCount = 1` before caller-supplied values are applied.*
- `AfterInsert` checks `RowsAffected <> 1` per [BR-001](../../business-rules.md#br-001-row-count-contention-check).
- No live `RetrieveSQL`, `UpdateSQL`, or single-item `DeleteSQL` — `clsXDocument` is effectively insert-only at the individual object level; collection-level retrieval and batch delete are handled by `clsXDocumentCollection`.

## Constraints and usage notes
- Always set `XPrintControlSeqNum` before inserting to link the document to a batch.
- `XBinTypeCode` and `CopiesCount` defaults can be overridden after `Create()` and before insert.
- `RetrieveSQL`, `UpdateSQL`, and `DeleteSQL` are all empty (throw) — individual document retrieve and update are not supported in this library.*

> **Note:** Statements marked with `*` were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.

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