Skip to content

expectationOperation

reference
1 min readUpdated

Kind: Class

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

Part of: Pams

expectationOperation holds metadata for an expected dashboard data field, including its stored name, field name, caption, expected field type, and data type. Dashboard code can read this metadata through getters and check isHidden() when deciding whether to display the field.

Methods

MethodSignatureReturns
SetStoredNameSetStoredName(name: string)void
GetFieldNameGetFieldName()string
SetFieldNameSetFieldName(name: string)void
GetTypeGetType()expectedFieldType
SetTypeSetType(type: expectedFieldType)void
GetCaptionGetCaption()string
SetCaptionSetCaption(input: string)void
SetDataTypeSetDataType(ty: DataTypeEnum)void
GetDataTypeGetDataType()DataTypeEnum
isHiddenisHidden()boolean
setHiddensetHidden(flag: boolean)void

Properties

PropertyType
callbackcallbackPRAny
CertainYearnumber
GetStoredNameany

Where it refuses work

  • expectationOperation stops the work with an early return when this.Field.StoredName.
  • expectationOperation stops the work with an early return when this.Field.FieldName.

Diagram

mermaid
graph LR
  Dashboard[Dashboard data consumer] --> Operation[expectationOperation]
  Operation --> StoredName[Stored name]
  Operation --> FieldName[Field name]
  Operation --> Caption[Caption]
  Operation --> FieldType[expectedFieldType]
  Operation --> DataType[DataTypeEnum]
  Operation --> Visibility[isHidden()]

Usage

ts
import {
  expectationOperation,
  expectedFieldType,
  DataTypeEnum,
} from "./core/models/dashboard-data-fields";

function configureExpectedField(
  type: expectedFieldType,
  dataType: DataTypeEnum,
): expectationOperation {
  const field = new expectationOperation();

  field.SetFieldName("customerName");
  field.SetCaption("Customer name");
  field.SetType(type);
  field.SetDataType(dataType);
  field.SetStoredName();

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

  return field;
}

AI Coding Instructions

  • Set the field name, caption, expected field type, and data type before passing an expectationOperation instance to dashboard consumers.
  • Pass values from expectedFieldType and DataTypeEnum rather than raw strings when calling SetType() and SetDataType().
  • Read metadata through GetFieldName(), GetCaption(), GetType(), and GetDataType() instead of duplicating field configuration elsewhere.
  • Check isHidden() in rendering or filtering code instead of assuming every configured field should be displayed.

Was this page helpful?

Download as PDF