Skip to main content
Version: 2.4

Data models

Data models are a way to represent business objects and their relations into an application.

A Data Model is composed of Data Types and relationships between them. Properties can be added to these types and data types can be connected together in order to create relations.

Any data type (from the Marketplace) can be added as a relation of another data type. Each property and relation of a model is displayed inside its box. The data types which are defined in other Data Models are available in the Marketplace (if imported/visible). You can delete the data type by clicking on the Delete button.

data_model

When creating a Data Model, it is recommended to also create a set of helper logic bricks to make it easier to manipulate that data. The standard terminology is:

  • Constructors are used to construct objects from a data type and the relevant parameters should be set. We may typically have multiple constructors to accommodate different criteria. Constructors are logic bricks that typically contain a Create Local Object brick, as well as a few Set Object Property and Persist bricks.

  • Getters are used to retrieve information from an object. Many functions need to retrieve more than one property of an object, therefore it is often more convenient to define a single function that provides all attributes. It is important to note that there is no harm in leaving outputs unconnected within a function.

  • Setters are used to modify information within an object.

From the Data Type Editor’s contextual menu, Generate Constructor/Generate Getter/Generate Setter opens a wizard to select from the list of available Folder(s) (a new Folder can also be created) where the constructor/getter/setter are generated and saved as pre-defined Actions and Functions.

Properties and relations

Properties are attributes of primitive types - String, Number, Date/Time, Boolean and Color. Properties are created by drag-and-dropping one of those types on the property zone of a data type. Properties can renamed or deleted.

Properties have the same lifecycle as the object: when the object is deleted, the property is deleted too.

Relations represent relationships with other data types. One single relation can link multiple objects. For example, a Car data type can have a passengers relation to a Person data type. Multiple Person objects can then be attached to the same passengers relation. Objects linked via relations have different lifecycles: when the object is deleted, a related object is not deleted.

A data type listed in the Marketplace can be drag-and-dropped on the relation zone of a Model. This creates a new relation. You can then change the name of the relation or delete it. If the target data type has been defined in that same Data Model, a line is drawn between them.

relation