---
title: Coverage combination management
summary: Creates, retrieves, and deletes Part A/B claim coverage-combination rows and exposes part-A/part-B membership lookups.
status: draft
owner: SAIF
last_reviewed: 2026-07-30
library: SAIF.Business.UnitStat.Claim
reference_type: package
operation_id: OP-USC-01
trigger: Caller invokes clsCoverageCombination.NewCoverageCombination / GetCoverageCombination or clsCoverageCombinationCollection.GetCoverageCombinationCollection, then Save() or Delete()
---

# Coverage combination management

A coverage combination connects two claims — one with coverage code `A` and one with coverage code `B` — that occur to the same worker on the same injury date. `clsCoverageCombination` maintains a single combination row, while `clsCoverageCombinationCollection` retrieves every combination row in the table for lookup or bulk-processing scenarios. Other library operations (loss-summary maintenance, in particular) use the Part-A/Part-B lookups to decide how to summarize Part-B-only claims.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-USC-01 |
| **Trigger** | Caller calls `NewCoverageCombination(dataportal, partAClaimID, partBClaimID)` to create, `GetCoverageCombination(dataportal, claimID)` or `GetCoverageCombination(dataportal, partAClaimID, partBClaimID)` to retrieve a single row, or `clsCoverageCombinationCollection.GetCoverageCombinationCollection(dataportal)` to retrieve all rows, then calls `Save()` or `Delete()` |
| **Inputs** | `PartAClaimID`, `PartBClaimID`, `ClaimID` (alternate retrieval key) |
| **Outputs** | Persisted or retrieved `US_COVERAGE_COMBINATION` row(s); boolean part-A/part-B membership results from the shared `IsCoverageCombinationPartA` / `IsNotCoverageCombinationPartA` / `IsCoverageCombinationPartB` / `IsNotCoverageCombinationPartB` properties |
| **Primary components** | `clsCoverageCombination`, `clsCoverageCombinationCollection` |
| **Entry point** | `Business\SAIF.Business.UnitStat.Claim\Coverage Combination\clsCoverageCombination.vb`, `Business\SAIF.Business.UnitStat.Claim\Coverage Combination\clsCoverageCombinationCollection.vb` |

## Steps

1. **Create.** `NewCoverageCombination(inDataportal, inPartAClaimID, inPartBClaimID)` builds a `Criteria` object carrying the two claim IDs and marks it `RetrieveType = NaturalKey`; `clsCoverageCombination.Create` then requests the next Oracle sequence value via `MyCriteria.DataPortalInfo.GetNextSeqNum("COVERAGE_COMBINATION_SEQ")` ([SQL-001](../sql/sql-001-select.md), `DUAL`) and copies `PartAClaimID`/`PartBClaimID` from the criteria into the new object.
2. **Insert.** `BeforeInsert` binds the generated `CoverageCombinationSeqNum`, `PartAClaimID`, `PartBClaimID`, and a freshly-set `UpdateNum = 0`, `UpdateUser`, and `UpdateDate`, then executes ([SQL-002](../sql/sql-002-insert.md), [US_COVERAGE_COMBINATION](../database-tables.md#us_coverage_combination)) ([BR-004](../business-rules.md#br-004-coverage-combination-identifiers-come-from-an-oracle-sequence)):
   ```sql
   INSERT INTO us_coverage_combination (
          coverage_combination_seq_num, parta_claim_id, partb_claim_id,
          update_num, update_date, update_user)
   VALUES (:CoverageCombinationSeqNum, :PartAClaimID, :PartBClaimID,
          :UpdateNum, :UpdateDate, :UpdateUser)
   ```
   - `AfterInsert`: if rows affected `<> 1`, adds `InsertError` ("Insert Failed"); otherwise calls `MarkOld()`.
3. **Retrieve a single combination.** `BeforeRetrieve` builds the base select and appends one of two WHERE clauses depending on `RetrieveType` ([SQL-017](../sql/sql-017-select.md), [US_COVERAGE_COMBINATION](../database-tables.md#us_coverage_combination)):
   - by claim ID: `Where PartA_Claim_ID = :ClaimID Or PartB_Claim_ID = :ClaimID`
   - by natural key: `Where PartA_Claim_ID = :PartAClaimID And PartB_Claim_ID = :PartBClaimID`
   - `AfterRetrieve`: loads the first returned row into the object, if any, and calls `MarkOld()`.
4. **Delete.** `BeforeDelete` binds `PartAClaimID` and `PartBClaimID` and executes:
   ```sql
   DELETE us_coverage_combination
    Where PartA_Claim_ID = :PartAClaimID
      And PartB_Claim_ID = :PartBClaimID
   ```
   - `AfterDelete`: if rows affected `<> 1`, adds a DB contention error message; otherwise calls `MarkNew()`.
5. **Retrieve all combinations (collection).** `clsCoverageCombinationCollection.BeforeRetrieve` selects every row with no WHERE clause ([SQL-017](../sql/sql-017-select.md), [US_COVERAGE_COMBINATION](../database-tables.md#us_coverage_combination)):
   ```sql
   Select US_COVERAGE_COMBINATION.COVERAGE_COMBINATION_SEQ_NUM as CoverageCombinationSeqNum,
          US_COVERAGE_COMBINATION.PARTA_CLAIM_ID as PartaClaimID,
          US_COVERAGE_COMBINATION.PARTB_CLAIM_ID as PartbClaimID,
          US_COVERAGE_COMBINATION.UPDATE_NUM as UpdateNum,
          US_COVERAGE_COMBINATION.UPDATE_DATE as UpdateDate,
          US_COVERAGE_COMBINATION.UPDATE_USER as UpdateUser
   From US_COVERAGE_COMBINATION
   ```
   - `AfterRetrieve`: instantiates a `clsCoverageCombination` per row, calls `Load(...)`, and adds it to the collection.
6. **Part-A / Part-B membership lookups.** `IsCoverageCombinationPartA(dpi, claimId)` retrieves the combination by `claimId` and compares its `PartAClaimID` to the input; `IsNotCoverageCombinationPartA` negates the result. `IsCoverageCombinationPartB` / `IsNotCoverageCombinationPartB` do the equivalent comparison against `PartBClaimID`. These are used elsewhere in the library (loss-summary maintenance) to detect a Part-B claim that is not part of any combination.
   - On failure: if no combination row exists for the claim, the underlying `GetCoverageCombination(dpi, claimId)` call surfaces whatever the framework retrieval returns for a missing row.**

## Process flow

```mermaid
flowchart TD
	Start([Caller requests coverage-combination operation]) --> Which{Create, retrieve,<br>or delete?}
	Which -->|Create| Seq[Get next Oracle sequence value]
	Seq --> Insert[Insert US_COVERAGE_COMBINATION row]
	Insert --> InsRows{RowsAffected = 1?}
	InsRows -->|No| InsErr([InsertError added])
	InsRows -->|Yes| InsOk([Marked old; combination persisted])
	Which -->|Retrieve single| RetKey{RetrieveType?}
	RetKey -->|ClaimID| RetByClaim[Select by PartA or PartB = ClaimID]
	RetKey -->|NaturalKey| RetByKey[Select by PartA and PartB]
	RetByClaim --> Loaded([Object loaded; marked old])
	RetByKey --> Loaded
	Which -->|Retrieve all| RetAll[Select all rows, no WHERE]
	RetAll --> Collection([Collection populated])
	Which -->|Delete| Del[Delete by PartA and PartB]
	Del --> DelRows{RowsAffected = 1?}
	DelRows -->|No| DelErr([DB contention error added])
	DelRows -->|Yes| DelOk([Marked new; row removed])
```

## Failure and edge-case behavior
- A rows-affected value of `0` on insert adds `InsertError`; on delete it adds a DB contention error — neither raises an exception, so callers must inspect the broken-rule/error collection after `Save()`.
- `clsCoverageCombination` has no update path: only create, delete, and retrieve are implemented. `AddBusinessRules()` is empty, so no property-level validation runs on this object.*
- `clsCoverageCombinationCollection.Criteria` carries its own template copies of the create, insert, update, and delete SQL properties ([SQL-001](../sql/sql-001-select.md) sequence select, [SQL-003](../sql/sql-003-insert.md) insert, [SQL-018](../sql/sql-018-update.md) update, [SQL-023](../sql/sql-023-delete.md) delete) — but the collection's `BeforeCreate`, `Create`, `AfterCreate`, `BeforeInsert`, `BeforeUpdate`, and `BeforeDelete` overrides are all commented out, so none of these four statements ever executes; they are dead code left over from the CodeGen2 template.*
- Only `clsCoverageCombination`'s own delete path executes an active delete ([SQL-022](../sql/sql-022-delete.md)); the collection cannot delete rows itself.*
- The collection's `Create`/`BeforeCreate`/`AfterCreate` overrides are also commented out, so the collection itself cannot be used to create new combination rows; only the single-object `clsCoverageCombination.Create` path does that.*

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [SQL catalog](../sql/index.md)
- [Database tables](../database-tables.md)

> **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
- `Business\SAIF.Business.UnitStat.Claim\Coverage Combination\clsCoverageCombination.vb`
- `Business\SAIF.Business.UnitStat.Claim\Coverage Combination\clsCoverageCombinationCollection.vb`
