Distribute report¶
ReportBase.Distribute is the consumer-facing distribution entry point on the IReport workflow. Unlike Print, it does not call Render — it calls Create directly to (re)generate report XML, then hands the XML and package name to clsPrint.distributeDocument, which independently decides between the synchronous and asynchronous transport paths.
| Field | Value |
|---|---|
| Operation ID | OP-PRT-06 |
| Trigger | Caller invokes ReportBase.Distribute(overwrite) |
| Inputs | Optional overwrite flag; the report's ReportPackage and report XML |
| Outputs | Boolean success; an ErrorDetail entry in Errors on failure |
| Primary components | Reporting.ReportBase.Distribute, Reporting.ReportBase.Create, clsPrint.distributeDocument |
| Entry point | Services\SAIF.Services.Printing\Reporting\ReportBase.vb |
Steps¶
Distributechecks whether rendered bytes are missing oroverwriteisTrue.- If so: it calls
Create(overwrite)to (re)generate report XML. Note that this step callsCreatedirectly rather thanRender, so it does not resolve a default printer or call the preview service the way Render report does.* Distributechecks thatm_reportXmlis notNothingandm_ReportPackagehas a non-zero length.- If either condition fails: distribution is skipped and
DistributereturnsFalse(via the unsetresultvariable). - When ready,
DistributecallsxPrint.distributeDocument(ReportPackage, ReportXml.ToString)— the Distribute document (synchronous or asynchronous) operation, which internally branches onAsynchronous(BR-001). - Note: this call serializes the report XML using
ReportXml.ToStringrather than theToXpression()xPression-specific serialization used byRenderin step 6 of Render report; the two workflows format the XML payload differently.* - On success,
resultis set toTrue. - On exception: any exception raised during steps 1–3 is caught, wrapped in an
ErrorDetail("An error occurred distributing the report.", ex), and appended toErrors;DistributereturnsFalse.
Process flow¶
The following diagram visualizes the create-then-distribute sequence.
flowchart TD
Start([Distribute called with overwrite]) --> NeedCreate{Bytes missing<br>or overwrite = True?}
NeedCreate -->|Yes| Create[Call Create overwrite]
NeedCreate -->|No| Valid
Create --> Valid{XML present and<br>ReportPackage set?}
Valid -->|No| Fail([Return False])
Valid -->|Yes| Call[Call xPrint.distributeDocument<br>ReportXml.ToString]
Call --> End([Return True])
Create -.->|Exception| Err[Add ErrorDetail, return False]
Call -.->|Exception| Err
Failure and edge-case behavior¶
Distributeskips validation of whether the XML was successfully created before proceeding, relying only on the null/length check in step 2; aCreateoverride that silently fails without throwing produces the sameFalseresult path as a missing package.*- Distribution uses
ReportXml.ToString()rather thanReportXml.ToXpression(), so the payload format sent toclsPrint.distributeDocumentdiffers from the payload formatRendersends to the preview service; whether this discrepancy is intentional could not be confirmed from source.** - Exceptions from either XML creation or the underlying distribute call are caught and converted into a single generic
ErrorDetailmessage that does not distinguish the two failure sources.
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.
Related documentation¶
Sources¶
Services\SAIF.Services.Printing\Reporting\ReportBase.vbServices\SAIF.Services.Printing\clsPrint.vb