---
title: Compare and locate affiliate associations
summary: Operation details for Compare and locate affiliate associations.
status: draft
owner: Technical Writer
last_reviewed: 2026-07-31
library: SAIF.Business.Policy.Affiliate
reference_type: package
operation_id: OP-013
trigger: A caller checks equality, tests collection membership, removes an item, or formats an identity string for affiliate-related business objects.
---

# Compare and locate affiliate associations

This operation documents how `Equality helpers on `clsAffiliate`, `clsPolicyAffiliateBase`, `clsCorporateOfficerExemption`, and the collection helper methods` fulfills the policy-affiliate behavior described for `SAIF.Business.Policy.Affiliate`.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-013 |
| **Trigger** | A caller checks equality, tests collection membership, removes an item, or formats an identity string for affiliate-related business objects. |
| **Inputs** | Affiliate or association objects plus comparison keys |
| **Outputs** | Boolean result, located item, removal, hash code, or display text |
| **Primary components** | Equality helpers on `clsAffiliate`, `clsPolicyAffiliateBase`, `clsCorporateOfficerExemption`, and the collection helper methods |
| **Entry point** | `Business\SAIF.Business.Policy.Affiliate\clsPolicyAffiliateBase.vb` |

## Steps

1. For policy-affiliate objects, compare policy number, affiliate ID, and effective date as the full identity ([BR-AFF-017](../business-rules.md#br-aff-017-policy-affiliate-identity-is-a-three-part-key)).
2. For standalone affiliates, compare SSN only; for corporate officer exemptions, compare exemption sequence number only.
3. Use the collection helper methods (`Contains`, `ContainsDeleted`, `Remove`, and `Where`) to scan existing and deleted lists for a matching item.
4. When the nested affiliate object no longer matches the association key, refresh it through the affiliate retrieve path before returning it ([BR-AFF-020](../business-rules.md#br-aff-020-stale-cached-affiliate-objects-are-reloaded-on-access), [SQL-001](../sql/SQL-001-saif-business-policy-affiliate.md)).

## Process flow
The following diagram shows the per-type identity comparison, collection-helper scanning, and the stale-affiliate refresh branch.

```mermaid
flowchart TD
  Start(["Caller compares, locates, or removes<br>an affiliate-related object"]) --> TypeCheck{"Object type?"}
  TypeCheck -->|"clsPolicyAffiliateBase-derived"| ThreePart["Compare PolicyNumber + AffiliateID + EffectiveDate"]
  TypeCheck -->|"clsAffiliate"| SsnOnly["Compare AffiliateSSN only"]
  TypeCheck -->|"clsCorporateOfficerExemption"| SeqOnly["Compare CorporateOfficerExempSeqNum only"]
  ThreePart --> Helpers["Use Contains / ContainsDeleted / Remove / Where<br>to scan live and deleted lists"]
  SsnOnly --> Helpers
  SeqOnly --> Helpers
  Helpers --> StaleCheck{"Nested affiliate key<br>still matches association?"}
  StaleCheck -->|No| Refresh["Refresh via affiliate retrieve path SQL-001"]
  StaleCheck -->|Yes| Cached["Return cached nested affiliate"]
  Refresh --> Result(["Return comparison/location result"])
  Cached --> Result
```

## Failure and edge-case behavior

- Collection membership checks are linear scans over the in-memory lists.

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

## Sources
- `Business\SAIF.Business.Policy.Affiliate\clsPolicyAffiliateBase.vb`
