Datastore Classes
The datastore class is a type of structure that can contain attributes and relation attributes (links between datastore classes) in order to conceptually describe its data and how they all interact with each other as well as methods to interact with the data in your model.

Once you create a datastore class, you can add attributes and methods to it.
When working in the workspace, the datastore class has a title bar at the top offering you many options to define how it is displayed without modifying the datastore class itself.
The toolbar contains three icons:
and
icons toggle the attribute type names column in the datastore class.
icon modifies the display settings for the datastore class.
icon hides the datastore class in the workspace.You can, however, rename the datastore class name by double-clicking the title bar. For more information, refer to the Rename a datastore class page in the Wakanda User Guide.
The
and
icons allow you to toggle the type names column, containing the names of the attribute types as well as the Applies To drop-down list for datastore class methods. The datastore class, when the third column is hidden, appears in the workspace as shown below:

Clicking on the
icon displays the following menu:






You can show or hide a datastore class in the workspace. To hide it, either select Hide from the datastore class’s contextual menu in the datastore class list or click the
icon in the datastore class’s toolbar. To show it again in the workspace, click on the datastore class’s name in the Datastore Classes area.

In the Properties tab, you can modify the datastore class’s properties:

)) of the datastore class. A public datastore class can be accessed from anywhere while a public on server datastore class can only be accessed on the server.By default, each datastore class is created with an ID attribute as the primary key, having the Mandatory, Autosequence and Unique properties checked as well as the Index Kind set to Auto by default.

In the datastore class’s panel, the attribute defined as the primary key is bold and underlined with the
icon next to it. To change the primary key, you can do so by either clicking on the
icon next to the new attribute name or by selecting an attribute in the Primary Key drop-down menu in the datastore class’s Properties tab. Only the attributes with valid types (Longint, Long64, Number, String, or UUID) are displayed in the drop-down menu.

You can also remove the primary key from your datastore class by clicking on the
icon next to the attribute; however, at least one attribute must be defined as the primary key in your datastore class.
In this area, you define the permissions for a specific datastore class:

You select a group from the dropdown menu to give it permissions to perform any of the following actions for a specific datastore class. For more information, refer to Permission Actions.
In the For Methods area, you can define the permissions for the datastore class methods in the datastore class.
You select a group from the dropdown menu to give it the permission to perform one or more of the following actions applied to the methods in the datastore class. For more information, refer to Permission Actions.
The Force Temporary Permissions checkbox allows you to temporarily override a particular setting, if you want to test your project for example. For more information, please refer to the "Forcing temporary permissions " section.
If you enter a space, it will be replaced by an underscore. The Class Name and the Collection Name must be unique and start with a letter, and can contain only numbers and letters. You can also include accented and non-Roman letters. For more information, please refer to the Naming Conventions section.
Note: Datastore class names are case-sensitive: “Employee” and “EmpLoyee” are not equal.
You can add code that will be automatically executed during the following events for a datastore class:
Note: For more information regarding the datastore class events, refer to DatastoreClass Events.
When you click the
icon next to an event, you will be prompted to define in which JS file you want to insert the code:

The code that appears in the file corresponds to the event you selected to add:
model.Company.events.save = function(event) {
// Add your code here;
};Note: For information regarding the event parameter, refer to Event parameter.
To open this JavaScript file again, click on the
icon to go directly to it. If you want to delete the event, you must do so in the JS file in which you wrote the code.
For more information regarding each of the datastore class events, refer to the DatastoreClass Events API.
Note: When developing on the client, keep in mind that the init event is triggered when an entity is created on the server. Therefore, datasource methods such as newEntity( ) or Button widgets having the “Create” action will not trigger this event. When the client attempts to save the entity, an update request is then sent to the server and an entity is created in memory on the server thus triggering the init event.
The listener function accepts a single event object as parameter. When the function is called, the parameter is filled with several properties that allow you to write generic code:
| Property | Type | Values |
| event.eventKind | string | "init", "load", "remove", "restrict", "set", "save", or "validate" |
| event.attributeName | string | Name of the attribute on which the event is set (when applicable) |
| event.dataClassName | string | Name of the datastore class on which the event is set |
You can define a method for a datastore class either in the Datastore Class’s Methods tab or at the bottom of the datastore class displayed in the workspace:

To edit the code for the method, click on the
icon.
Note: For more information, please refer to the Datastore Class Methods section.
Modified in v11
When you extend a datastore class, a new datastore class is created that includes not only its attributes, but also its methods. This new datastore class is called the “derived” datastore class and its attributes and methods are “inherited” from the extended datastore class.
This concept allows you to build applications using basic datastore classes that can be extended to allow for specialized data schemes. For example, if we create a “Person” datastore class, it can be extended into other datastore classes, like “Student” and “Teacher” because many of the same attributes are in all three of these datastore classes.
In the settings, you can show/hide from the datastore class panel the removed inherited attributes, inherited attributes, and inherited methods:

With derived datastore classes, you can:
You can modify the following properties of inherited attributes:
You cannot modify the following properties for inherited attribute: