Fields are the most elementary part of your graph. It, in a sense, defines what columns your table will contain. Fields can be of different types such as text, image, file, date, time etc. and they directly impact how the CMS works as well as the APIs.
Example: A
Movie
table would havetitle
,summary
,posterImage
,genres
as fields .
Field Settings
Property | Description |
---|---|
Name | The name of the field. Used in the graph and the CMS. |
Key | The identifier used in the API. Needs to be unique amongst its sibling nodes. |
Input Type | The type of data this field will hold. Canonic supports a variety of field types such as text, image, toggle, date etc. Learn More |
Default Value | The default value for this field. If no value is specified when creating an entry, then this value is automatically added to this field Learn More |
Creating a Field
Create a field by clicking on the + button next to a table or fieldset node on the graph. You will see a new field pop up on the graph with the the properties panel for the field visible below. Fill out fields. Once done, close the properties panel to save your changes.
New fields won't reflect in already live APIs unless published. See [Publishing] for more information.
Editing a Field
You can edit a field by clicking on the field node on the graph. The properties panel will open up where you can edit all necessary fields.
Note: Some properties are editable but are not recommended to be edited once you go live with your project as they can cause loss of data. You will be shown a warning when performing such actions.
Note Although changes are saved automatically, they must be published for them to reflect in the APIs and the CMS
Deleting a Field
A field can be deleted by simply right clicking on the field and selecting delete.
Caution! This is a dangerous action and can cause permanent loss of data once the graph is published.
Field Validations
You can add validations to the field to make sure the correct data is being save corresponding to this field. See Field Validations for more information.
Adding data for a Field
Data that the field is designated to hold can be added through the Content Management System or through the generated APIs.
Primary Key
Each table must have a designated primary field. This field is then used in the Content Management System to display the list of items.
Example: For the Books table set the
Book Name
field as the primary field. When you open the CMS, you will see a list of books referred to by their book names.
Setting/Changing the Primary Key
Only text type fields can be marked as primary fields. We automatically mark the first text field you create for a table as the primary field.
The primary key can be manually set by right-clicking on any Text
type field and clicking on "Mark as Primary".