---
title: Load application codes
summary: Loads application codes for administration or lookup, optionally restricted to active-only codes.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-08-17
library: SAIF.Business.Menu
reference_type: package
operation_id: OP-MENU-05
trigger: Caller requests `GetAllApplicationCodes` or `GetActiveApplicationCodes`
---

# Load application codes

Loads application codes for administration or lookup, optionally restricted to active-only codes.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-MENU-05 |
| **Trigger** | Caller requests `GetAllApplicationCodes` or `GetActiveApplicationCodes` |
| **Inputs** | `IDataPortalInfo`, active-only flag |
| **Outputs** | Populated `clsApplicationCodeCollection` |
| **Primary components** | `clsApplicationCodeCollection.GetAllApplicationCodes`, `GetActiveApplicationCodes` |
| **Entry point** | `SAIF.Business.Menu/clsApplicationCodeCollection.vb` |

## Steps

1. `GetActiveApplicationCodes` builds `Criteria(dpi, activeOnly:=True)`; `GetAllApplicationCodes` builds `Criteria(dpi)` with `ActiveOnly = False`. ([BR-MENU-013](../business-rules.md#br-menu-013-active-only-application-filtering))
2. `BeforeRetrieve` selects `RetrieveActiveSQL` ([SQL-014](../sql/SQL-014-retrieve-active-application-codes.md), adds `WHERE NVL(ACTIVE_CODE,'Y') = 'Y'`) when `ActiveOnly` is set, otherwise the unfiltered `RetrieveSQL` ([SQL-013](../sql/SQL-013-retrieve-all-application-codes.md)). (table [BUSONLINE_APPS_CODE](../database-tables.md#busonline_apps_code))
3. `AfterRetrieve` loads one `clsApplicationCode` per row and marks each old.

## Process flow

```mermaid
flowchart TD
    Start([GetAllApplicationCodes / GetActiveApplicationCodes]) --> Choice{ActiveOnly?}
    Choice -->|Yes| Active["RetrieveActiveSQL: WHERE NVL ACTIVE_CODE,'Y' = 'Y'"]
    Choice -->|No| All[RetrieveSQL: unfiltered]
    Active --> Load[AfterRetrieve: Load each clsApplicationCode, MarkOld]
    All --> Load
    Load --> Done([Return populated collection])
```

## Failure and edge-case behavior
- No rows match (e.g., no active codes exist): an empty collection is returned, not an error.

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

## Sources
- SAIF.Business.Menu/clsApplicationCodeCollection.vb
