Documentation

Model Reference

In this article

In this article, you'll learn all about each setting you see while creating or editing a Model.

Jim Dekker

Published: 27-09-2019

Last updated: 10-10-2019

Let’s start by creating a new Model.

Click Datamodel in the Builder Bar of your application. This will open the Datamodel overview of your application.

Click `+ New`  in the top left corner (the blue button) and a tab will open. 

Model (new)

Name: Choose a name for your Model.We recommend taking naming conventions in account. For example, the name of your model should be in English, CamelCase, and singular. Most importantly, be consistent. The name of the model must be unique within your Datamodel

Help text: Optionally, you can add a help text when you feel the Name of your model needs some further explanation.

Click `Save` and then `Edit` in the top right corner (the blue button) for additional options.

General settings

When editing a Model, you'll see 3 fieldsets, each containing their own subject:

  • Model
  • Deduplicate
  • Dependent items

Model (existing)

This fieldset contains the most important settings for each Model. Here you can edit the name and permissions of your Model. Note: When changing the Name of a Model the old Name doesn’t change at places where the old Name already may exist (like grid views or in related Models). So choose the Name of your Model wisely. 


Name: Choose a name for your Model.We recommend taking naming conventions in account. For example, the name of your model should be in English, CamelCase, and singular. Most importantly, be consistent. The name of the model must be unique within your Datamodel.
Help text: Optionally, you can add a help text when you feel the Name of your model needs some further explanation.
Label property: By selecting the label property, you can choose which property's label will appear in subview buttons and is included in API requests when collected as relation. If you don’t select a property, the grid view will show your Model’s id property by default. Don’t worry when you leave this setting untouched, you can change the setting whenever you feel like.
Order: Allows you to order your data when collected as a relation for selectboxes in the backoffice.
Allow mass delete: By default the checkbox is unchecked. Enabling this setting, allows you to mass delete your Model data in your application's Backoffice grid(s). In your grid, you can select the records' checkboxes. After your selection is made, choose `Delete` in the select box in the bottom left corner of your grid. Click `Execute` to delete all selected records.
Log mutations: By default the checkbox is unchecked. When checked a new relation called *yourModel*_record_mutation will automatically be added in your Model. You can add a subview in your application's Backoffice grid. By default, the subview is called *yourModel*_record_mutation, but you can change the name to anything you want. The subview displays the number of changes in the data, which user made the change(s) and when the data has been changed. You even can see the previous value of the data.

Log mutations options

Available after: Log mutations is enabled

By default, Log all changes except these properties is selected. You can change this to Log only changes on these properties. You can change or add any property you would like to log. By default, `updated_at` and `created_at`  are selected.


Autocomplete:  By default, the checkbox is checked.
Is settings model: By default, the checkbox is unchecked. With this setting enabled you can copy the records from your model to your Sandbox(es) when merging, each record containing identical identifiers. This is very useful when records are used in filters, variables and other settings. 
Note: This functionality is not designed for cloning large databases. We recommend using the export/import options to do so.
Permissions: You can set permissions and filters for each role in your application. More information about permissions can be found here: What are model permissions?

Deduplicate

This option can be checked if you want to deduplicate existing or newly added data in your database. When checked, the following fieldsets appear:

  • Match on
  • Optional match on
  • Update property on match
  • When to duplicate

Match on

Name: Choose a properties to determine on which data should be deduplicated. You can choose in what manner your data should match the existing data. You can choose:

  • Equals
  • First Character
  • First Characters
  • Matches

Optional match on

When the chosen property of your new/changed record matches the existing data with the Match on option, you can you can perform an optional check to make a match.

Name: Choose a properties to determine on which data should be deduplicated. You can choose in what manner your data should match the existing data. You can choose:

  • Equals
  • First Character
  • First Characters
  • Matches

Update on property match


Value: Set the property/properties which should be updated when duplicate data is found. The New value of the data in your record will only overwrite existing data on the properties set in this fieldset. 
Note: The oldest data value will overwrite the newer data in your record on each property which isn’t set in this fieldset. The new data will no longer be available!

When to duplicate


create: Deduplicates on all Create operations of the model.
update: Deduplicates on all Update operations of the model.
save: Deduplicates on all Save operations of the model (even when the record isn’t changed), overruling the other 2 options.

Dependent items


This additional fieldset shows all dependencies of the model you are currently working on. That means if a Backoffice grid is generated or included in an expression, it will be shown here. More information about dependencies can be found here: What are Dependencies?

Changes [⇄]

In Changes, all metadata (structural) changes applied to the application can be found, who applied them and when. More information about Changes can be found here: What are Changes and HowTo use them?

Properties

Clicking the `Properties`  button opens your Model properties' panel.


Properties +

Clicking the `+` button lets you quickly add a new property to your Model. You’ll enter the same panel which can be reached by clicking the `Properties` button followed by the `+ New`  button. Using the `+` button saves you one click, isn’t that amazing!


Relations

Clicking the `Relations`  button opens your Model Relations' panel.


Relations +

Clicking the `+` button lets you quickly add a new Relation to your Model. You’ll enter the same panel which can be reached by clicking the `Relations`  button followed by the `+ New ` button. Using the `+` button saves you one click, isn’t that amazing!

In this article