---
title: Remove, clear, or delete preferences
summary: Resets a single preference, a scope, or all preferences held in memory.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-08-17
library: SAIF.Presentation
reference_type: package
operation_id: OP-PRES-004
trigger: Consuming code resets a single preference, a scope, or all preferences
---

# Remove, clear, or delete preferences

This operation covers the three in-memory reset paths on `clsPreferences`: removing a single key, clearing a scope's items, and deleting every loaded record. None of the three persist the change — [Persist preferences](persist-preferences.md) must follow.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-PRES-004 |
| **Trigger** | Consuming code calls `Remove`, `Clear`, or `Delete` |
| **Inputs** | Key and/or scope |
| **Outputs** | Mutated in-memory `Preference` records |
| **Primary components** | `clsPreferences.Remove` (two overloads), `clsPreferences.Clear`, `clsPreferences.Delete` |
| **Entry point** | `SAIF.Presentation/clsPreferences.vb` |

## Steps

1. **`Remove(inKey)` / `Remove(inKey, inScope)`**:
   - Logs entry via `clsLogTrace.MethodBegin()`.
   - Exits silently on a `Nothing` key ([BR-PRES-006](../business-rules.md#br-pres-006-a-nothing-key-is-a-no-op)).
   - Lower-cases the key ([BR-PRES-007](../business-rules.md#br-pres-007-preference-keys-are-case-insensitive)).
   - Locates the matching `Preference` record and removes the item when present; a missing key is a silent no-op ([BR-PRES-016](../business-rules.md#br-pres-016-removing-an-absent-key-is-a-no-op)).
2. **`Clear(scope)`**: locates the `Preference` record for the current application + resolved page key and clears **all** of its items ([BR-PRES-017](../business-rules.md#br-pres-017-clear-empties-all-items-in-a-scopes-record)).
3. **`Delete()`**: clears the items of **every** loaded `Preference` record, regardless of application or page ([BR-PRES-018](../business-rules.md#br-pres-018-delete-empties-every-loaded-record)).
4. None of the three persist the change — [Persist preferences](persist-preferences.md) must be called explicitly ([BR-PRES-019](../business-rules.md#br-pres-019-mutations-are-in-memory-until-save)).

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([Remove / Clear / Delete called]) --> D1{Which operation?}
	D1 -->|Remove| R1[Key is Nothing?]
	R1 -->|Yes| REnd([No-op])
	R1 -->|No| R2[Lower-case key, locate record, remove item if present]
	D1 -->|Clear scope| C1[Locate record for application + page key]
	C1 --> C2[Clear all items in that record]
	D1 -->|Delete| E1[Clear items in every loaded record]
	R2 --> EndMem([In-memory records mutated])
	C2 --> EndMem
	E1 --> EndMem
	EndMem --> Note[Save must be called to persist]
```

## Failure and edge-case behavior
- Removing a key that is not present is a silent no-op ([BR-PRES-016](../business-rules.md#br-pres-016-removing-an-absent-key-is-a-no-op)).
- `Delete()` affects every loaded application/page record for the user, not just the current application — callers must be careful about scope when calling `Delete()`.

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)

## Sources
- `SAIF.Presentation/clsPreferences.vb`
