# Delta

**Kind:** Class

**Source:** `Pams/Web/Pams.WebApp/Client/app/core/models/dashboard-data-fields.ts` (line 316)

**Part of:** [Pams](subsystem-pams)

`Delta` represents a dashboard data field and stores its field name, persisted name, display caption, and `DeltaTypeEnum` type. It also tracks whether the field should be hidden when dashboard data is displayed or processed.

## Methods

| Method | Signature | Returns |
|---|---|---|
| `isHidden` | `isHidden()` | `boolean` |
| `setHidden` | `setHidden(flag: boolean)` | `void` |
| `GetStoredName` | `GetStoredName()` | `string` |
| `SetStoredName` | `SetStoredName(name: string)` | `void` |
| `GetFieldName` | `GetFieldName()` | `string` |
| `SetFieldName` | `SetFieldName(name: string)` | `void` |
| `GetType` | `GetType()` | `DeltaTypeEnum` |
| `SetType` | `SetType(type: DeltaTypeEnum)` | `void` |
| `GetCaption` | `GetCaption()` | `string` |
| `SetCaption` | `SetCaption(input: string)` | `void` |
| `SetDataType` | `SetDataType(ty: DataTypeEnum)` | `void` |
| `GetDataType` | `GetDataType()` | `DataTypeEnum` |
| `GetFieldNameTarget` | `GetFieldNameTarget()` | `string` |
| `SetFieldNameTarget` | `SetFieldNameTarget(name: string)` | `void` |
| `GetStoredNameTarget` | `GetStoredNameTarget()` | `string` |
| `SetStoredNameTarget` | `SetStoredNameTarget(name: string)` | `void` |

## Where it refuses work

- `Delta` stops the work with an early return when `this.FieldName`.

## Diagram

```mermaid
graph LR
  Delta[Delta]
  StoredName[Stored Name]
  FieldName[Field Name]
  Caption[Caption]
  Type[DeltaTypeEnum]
  Hidden[Hidden State]

  Delta --> StoredName
  Delta --> FieldName
  Delta --> Caption
  Delta --> Type
  Delta --> Hidden
```

## Usage

```ts
import { Delta, DeltaTypeEnum } from "./dashboard-data-fields";

function createDashboardField(type: DeltaTypeEnum): Delta {
  const delta = new Delta();

  delta.SetStoredName("totalAmount");
  delta.SetFieldName("TotalAmount");
  delta.SetCaption("Total Amount");
  delta.SetType(type);
  delta.setHidden(false);

  return delta;
}

const field = createDashboardField(existingField.GetType());

if (!field.isHidden()) {
  console.log(field.GetCaption(), field.GetFieldName());
}
```

## AI Coding Instructions

- Keep dashboard field metadata in `Delta` through its getter and setter methods rather than duplicating field-name mappings elsewhere.
- Use `GetStoredName()` for persisted or backend-facing field identifiers and `GetFieldName()` for the dashboard field identifier.
- Check `isHidden()` before rendering or exposing a field in dashboard UI code.
- Pass a valid `DeltaTypeEnum` value to `SetType()` so consumers can handle the field according to its configured type.
