Skip to main content

System state

In ADITO, there are 2 types of system states, which can be retrieved via system variables:

  • "operating state" -> vars.get("$sys.operatingstate")
  • "record state" -> vars.get("$sys.recordstate")

The values of these state variables are Strings, namely (both for operating state and record state)

  • "VIEW"
  • "NEW"
  • "EDIT"
  • "SEARCH"

When coding and checking a state for a specific value, you should not use the above Strings itself, but the corresponding constants

  • neon.OPERATINGSTATE_VIEW
  • neon.OPERATINGSTATE_NEW
  • neon.OPERATINGSTATE_EDIT
  • neon.OPERATINGSTATE_SEARCH
note

These constants are used both for operating state and for record state. There are no specific constants for record state.

Operating state and record state are similar, but apply in different environments:

  • Operating state refers to the state a Context is currently in, while
  • record state refers to the state of a record or even only a part of a record.

Example: If you are in a MainView and use the pencil button of a component, the Context is still in the operating state "VIEW", while the part of the record, which is covered by the component, is in record state "EDIT".

Another example: If you are in an EditView, operating state is "EDIT", because the whole Context is now in the "EDIT" mode. The record state is now also "EDIT", because the record is edited with the help of the EditView.

important

In most cases, you should use $sys.recordstate to determine if data is being edited, as the operating state still can be the VIEW mode, while the record state is EDIT.
Use $sys.operatingstate to determine if you are in an EditView.

Code example:

if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null )
{
result.string(util.getNewUUID());
}

Example code of valueProcess that presets an ID, if a new record is created. (Usually not required, as done automatically.)