Lazy-load policy detail¶
The policy header deliberately stays small. Chapter code, combination and wrap-up flags, current balance, entity description, group name, and similar fields are loaded only when something actually reads them. This operation performs that deferred load, along with the several derived values — coverage-bound flag, secondary status, gaps, last audit date — that each carry their own database call.
| Field | Value |
|---|---|
| Operation ID | OP-02 |
| Trigger | A detail-backed property is read for the first time |
| Inputs | The already-loaded clsPolicyData instance |
| Outputs | Roughly twenty detail fields populated on the same instance |
| Primary components | clsPolicyData.RetrievePolicyDetail, clsPolicyData.FillDetail |
| Entry point | Business/SAIF.Business.View.Policy/clsPolicyData.vb |
Steps¶
- Check the detail-read guard flag. Set it immediately, before the request runs, so that the load happens at most once per instance.
- If the flag is already set, return without any database work.
- Build a stored procedure request for
pk72846_view_policy.getviewdetailwith the policy number and a result cursor, registering the fill routine as the after-request callback. - Map roughly twenty detail columns onto the instance, converting string-typed dates and numbers through the framework's smart-type wrappers.
- Values that the procedure masks for an unprinted reduced-form period arrive as empty strings or zeros and are stored as such.
- Swallow any failure raised during the lazy read so that the already-loaded header stays usable (BR-014).
- On failure the detail properties keep their empty defaults, and the caller cannot distinguish a failed load from genuinely empty data.**
- Resolve the derived values that are not part of the detail row, each on its own first read:
- Coverage-bound flag, through an Oracle function wrapped in a
SELECT ... FROM DUAL(SQL-014). - Secondary cancellation and collection status, through the same wrapping pattern (SQL-020).
- Pending future cancellation date, from the most recent non-reinstated, non-rescinded cancellation row (SQL-015, CANCELLATION).
- Last completed final audit date, ranked by a fixed selection-category priority (SQL-018, PA_AUDIT).
- Coverage gaps (SQL-016), information-page-printed status (SQL-017), and the wrap-up legal name (SQL-021).
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Detail property read]) --> G{Detail already loaded?}
G -->|Yes| Ret([Return cached value])
G -->|No| M[Set the guard flag]
M --> Q[(pk72846_view_policy.getviewdetail)]
Q --> OkQ{Request succeeded?}
OkQ -->|Yes| F[Map detail columns<br>onto the instance]
OkQ -->|No| Sw[Swallow the failure<br>and keep empty defaults]
F --> D[Resolve derived values<br>on their own first read]
Sw --> D
D --> Ret
Failure and edge-case behavior¶
- Detail load failure: swallowed, leaving empty detail values and a usable header (BR-014).
- A masked reduced-form period returns empty or zero values that are indistinguishable from missing data.**
- Each derived value is a separate round trip, so a view that reads all of them issues several calls.
Note: Statements marked with
†are derived from dependency library documentation via the Legends CLI. Statements marked with*were inferred from code structure or contextual evidence. Statements marked with**could not be confirmed; treat as unknown until verified.
Related documentation¶
- Operations and processes
- Business rules
- SQL catalog
- Database tables
- Procedures
- Security and authorization
- API reference
Sources¶
Business/SAIF.Business.View.Policy/clsPolicyData.vb