Skip to main content
Version: 1.22.3

Records in Data Structure

In SimpeOne, a record is the main object for storing and presenting information. It contains filled-in attribute values of the table to which it belongs. A record corresponds to a row of a relational database.

The information in the records has different purposes. The records contain user, transactional, historical, configuration data and system settings. For example, the records that contain the information about the version configuration.

Any record has a set of fields that are always filled in by the system when creating and/or updating it:

The records of all tables of a particular data type or purpose always have the following mandatory fields:

  • A field of the Record Class type is automatically created when a table is extended and identifies the table to which a particular record belongs.
  • For configuration data records, the Policy and Application fields are mandatory.
  • The Number is assigned to the records of transactional tables for which a record numbering is configured. Unlike ID, it is optional and customizable.

In SimpleOne, you can interact with records through the interface as well as through various APIs (server API, REST API).

Record operations

Both users and processes can interact with records. These interactions are represented by the CRUD (create, read, update, delete) operations.

Each operation is a separate transaction – a sequence of actions that moves the database from one consistent state to another. A consistent state is the expected state of up-to-date information that is reflected in the database.

Create


At the moment of creating a record, the user works with a virtual object. The record does not exist until it is sent to the database. When the record is created, a transaction starts and as a result a real record appears in the database.

The access control rules (ACL) are triggered when it is required to create a virtual object of a record. They check whether the user has access to create records. Then, the fields are filled in with the default values. At the time when the record is sent to the database, all related engines are processed.

Read


When reading a record, the user sees the available content of the record: attributes and their values.

This operation does not trigger transactions that change the state of a record. The access control rules (ACL) determine whether the user can read the record or a part of its content.

Update


When a user updates a record, they work with a virtual temporary object. Unlike the create operation, the object is populated with the information from the database. To add the information to the database, the system initiates the update transaction. It is the same as the create transaction, except for creating the record in the database.

The update operation can be restricted with the access control rules (ACL). When a record is sent to the database, all related engines are processed.

Dirty attributes

An attribute is considered dirty if its value has changed and does not match the previous value. A dirty attribute is also considered to be an attribute whose value changes sequentially, as in the example below:

Dirty attributes
let prev = current.planned_end_datetime;
// в prev пустая строка ""
current.planned_end_datetime = '2024-02-13 12:12:12';
current.planned_end_datetime = prev;

To solve the problem of data overwriting, when the same record is updated due to several unrelated cases that have different sets of updated fields, the dirty attribute mechanism is implemented in SimpleOne. That means that only dirty attributes will change in the database, and not all attributes of the record.

caution

The dirty attribute mechanism does not work for records of the following tables:

  • Indicators (sys_indicator)
  • Indications (sys_indication)
  • Scheduled Scripts (sys_scheduled_script)
  • Scheduled Imports (sys_scheduled_import)
  • Scheduled Jobs (sys_scheduled_job)

Delete


When a record is deleted, the record information is removed from the database. At the time of deletion, all related engines are processed.

You can restore the deleted records from the Record Deletion Log (sys_record_deletion_log), if the table that contained the deleted record has the Record deletion logging checkbox selected.

Unique record ID

Each record in the instance is identified with a unique 18-character identifier stored in the ID (sys_id) column.

The record ID is unique within a table (including records in parent/child tables) and cannot be changed after the record is saved.

You can find the ID of any record manually, or by using a script.

Get an ID from a record URL


The ID of a record is always a part of the URL that leads to this record. For example, an article record with the URL as in the example below has the ID equal to '158815469913225806'.

https://\<instance_url>/record/article/158815469913225806

It can be obtained from the browser address bar or by copying the URL of the item at the navigation panel or on the list view.

Get an ID using a script


The ID of a record can be retrieved using a script: