Field Definition

In Accelerator Platform, a field is a named data element that is used to store and represent a particular type of information within an object. Fields are used to define the attributes of an object, specifying the types of data that can be stored within the object, such as text, numbers, or dates.

Fields can be customized with different data types and validators, allowing developers to specify the format and rules for each field. For example, a text field might have a maximum length or a specific character set, while a number field might have a minimum or maximum value.

Fields can also be used to define relationships between objects, allowing data to be connected and related in meaningful ways. For example, a field in a customer object might be used to store email address of the user.

Fields are an essential part, providing a flexible and powerful way to store and manage data within any application. By customizing fields and their associated data types and validators, developers can ensure that data is stored and processed correctly, and that data integrity and consistency are maintained.

A field contains the following items :

Key
Description

_id

This is a system generated id

name

This is a unique name of the filed.

label

This a display label for a field

type

type of the field. Table below shows all the field types that are supported

validators

type of validations to apply on this field. The table below shows validators available for different field types

Example a text field type with multiple validators. Check out the list of validators here.

// This is a text field named "Patient Name"
{
        "type": "text",
        "name": "name",
        "label": "Patient Name",
        "validators": {
            "isRequired": true,
            "minChars": 3,
            "maxChars": 50
        }
    }

Accelerator platform offers multiple range of fields. Here is a list of fields that it offers :

Field Type
Data types
Description

text

String

This is used to store any kind of data in a table.

number

Integer/Double

The number field is capable of storing rational numbers.

date

Datetime

The date field accepts dates in a string format conforming to ISO 8601 standards.

email

email

This is used to store email address.

choice

String

This is used when there is a need to store a selection of values from a range of options, a choice field can be used.

file

String

This is used to insert an item that contains a file field, a two-step process is required. First, the file(s) must be uploaded using the UploadFiles API endpoint, which returns a list of IDs of the uploaded files. These IDs can then be used as the file field value when inserting an item.

reference

String

This field is used to store the '_id' of an Item from another Object within the same Organization.

array

JSON Array

This Field is used to store JSON Array.

object

JSON Object

This Field is used to store JSON Object.

Using the field type above you can create any field as per your requirement. Here is an example of a field called "firstName".

// Example of firstName as field type.
{
  "name": "firstName",
  "label": "First Name",
  "type": "string",
  "isEncrypted": true,
  "validators": {
    "isRequired": true,
    "isUnique": true,
    "regex": "string",
    "minChars": 0,
    "maxChars": 0,
  }
}

Last updated