Table fields in a database
Learn about fields in data tables in Actioner and how to configure them.
Fields are the building blocks of a table. There are various field types that you can use in defining your data table structure. Fields also have the following common properties, and when creating a new field for a table, you need to decide on these properties.
Field properties
Each table has an
id
field.id
is automatically generated to identify a record in a model. id field cannot be edited or deleted.A field can be required while some of the values of a table are nice-to-have. For instance, in a leads table, the email address of the lead can be mandatory to continue comms while their job title is an optional value. In this case, you can mark Required option for only the email field. When a record is created or updated, no value existence checks would be applied to an optional field.
A field can be read-only. Values of a read-only field cannot be modified once it is set. For example, you can define the subscription date of a customer or the creation date of a ticket as read-only, since these values should not change even if the subscription data or the ticket is updated.
A field can have a default value. When creating a new record for your table, you might need to assign a default value for a field in case its value is not provided as an input. If your field is a boolean, you can select
true
orfalse
default options, or continue with unsetting a default value.A text field can have validation rules. There are 2 types of validation rules:
- Constraint length: You can set min and max character lengths for a text field, or min and max value for a number field.
- Regular expression: You can set Javascript regular expressions to strengthen filtering of data and extracting information to your table records.
A date-time field can have a
UTC Milliseconds
orISO 8601
format.A field can reference to the
id
field of another table in your app. When you add a reference field, you can set a relationship between two tables. The selected table becomes linked to the reference field.
Field types
Text fields
Text
Text fields are used to store textual information. Use this field to store short textual information such as a username, or a description.
When adding a new text field, you can specify
- if field is required.
- if field is read-only.
- validation rules for min and max character length.
- regular expression to filter data.
- default value of the field.
Email
Email fields are used to store email data. They are text fields with a preset email validation rule.
When adding a new email field, you can specify
- if field is required.
- if field is read-only.
- default value of the field.
URL
URL fields are used to store URLs. They are text fields with a preset URL validation rule.
When adding a new URL field, you can specify
- if field is required.
- if field is read-only.
- default value of the field.
Phone number
Phone number fields are used to store phone numbers.
When adding a new phone number field, you can specify
- if field is required.
- if field is read-only.
- default value of the field.
UUID (Universally unique identifier)
UUID fields are used to store data in 128-bit number format. Use this field to uniquely identify your data.
When adding a new email field, you can specify
- if field is required.
- if field is read-only.
Numbers
Integer
Integer fields are used to store integers. They are text fields with a preset integer validation rule.
When adding a new integer field, you can specify
- if field is required.
- if field is read-only.
- default value of the field.
Decimal
Decimal fields are used to store integers. They are text fields with a preset decimal validation rule.
When adding a new decimal field, you can specify
- if field is required.
- if field is read-only.
- default value of the field.
Date time
Date time are used to store date and time in UTC Milliseconds
or ISO 8601
format.
Stores date and time values in ISO 8601 format
When adding a new date time field, you can specify
- if field is required.
- if field is read-only.
- its format:
UTC Milliseconds
(e.g., 1671451714000) orISO 8601
(e.g., 2022-12-19T15:08:34.345+03:00). - default value of the field.
Collection
List
List field are used to store a list of items. A list is an ordered collection of elements. All elements in a list must be of the same field type. You can use list fields to store an array (list) of basic data types, such as a list of tags or keywords.
When adding a new list field, select the type of items to store. Available types are
- text fields (text, email, URL, phone number, UUID).
- number fields (integer, decimal).
- date time fields
- boolean fields.
- reference fields.
When adding a new list field, you can specify
- if field is required.
- if field is read-only.
- Min and max item length on List validations fields.
Map
Map field are used to store a list of items. A map is an sorted collection of pairs of elements, a key and a value. The sorting order is based on the key values. You can use map fields to store a map of basic data types, such as a list of different user properties.
When adding a new map field, select the type of items to store. Available types are
- text fields (text, email, URL, phone number, UUID).
- number fields (integer, decimal).
- date time fields
- boolean fields.
- reference fields.
When adding a new map field, you can specify
- if field is required.
- if field is read-only.
- Min and max item length on Map validations fields.
- validations of the selected list item on Map validations fields.
Boolean
Stores basic true
or false
values.
When adding a new boolean field, you can specify
- if field is required.
- if field is read-only.
- default value of the field:
true
,false
or No default value.
Reference
In some cases, you might need to have a reference to another table in your databaases. Object references are used to set up these relationships. A field can reference to the id
field of another table in your app. When you add a reference fields, you can set a relationship between two tables. The selected table is linked to the reference field.
When adding a new reference field, select the data table that you will be referencing in this field. Npte that you can only select from tables in your app.