Your application needs an efficient and structured way to store data. WEM allows you to do this at the Data Model area of the WEM Modeler. Here, you specify the data you need, what type of data you need, and how all the data should be organized.
When you are modelling a large application, it is not unusual to have many different types of data stored in your application. In order to keep the lists manageable, the WEM Modeler has the ability to create folders and store data in lists, in these folders. This way you can create a hierarchy of folders that reflect your application.
For example, you are building a product management application. When you start out, you realize you need to store product management data, but also data that is used for user authentication. You could end up with a very simple folder structure that looks like this:
The way WEM organizes data, is through lists. A list is a model of an entity that describes the properties of that entity. For example, the entity "Customer" has properties such as Company name, Company address, URL, Telephone number, etc. To use such an entity in WEM you would create a
listin the datamodel, and in this list create
fieldsthat represent the properties of the entity.
There are two types of lists:
- Database list - this type of list stores the data in a database, and therefore all data is remains available when you stop using the application and come back at a later time
- Transient list - this type of list does not store data permanently. Instead it only stores data as long as the application session lasts. You would store data in a transient list when you only need temporarily. A good example is a shopping cart of an online store: you can add items to the shopping cart, but once you leave the online store or you close your browser, the data is deleted. You no longer need the data (the items) in the shopping cart so you do not need to store that data permanently.
When you right-click or use the context menu button [...] on items in the
Data model-tab, you get to all the data model functionalities. You will also see a menu with several options:
After you select
New list, you get a popup where you can enter the following:
Name: this is the name you want to give the list. It must be a unique name;
Technical name: the technical name is an automatically generated field. This is the name WEM uses to reference this field. You will see this name when you are, for example, using expressions where you need to access this field.
List type: You can choose whether you want a
transient listor a
database list. The rows of a database list are stored in the database of the project. The data in a transient list have the lifetime of the client session.
Savebutton and the list is created.
Introduced 2022-06-27, you can define a Default Label on a List (entity), using an expression that can use fields from the list to generate a Label-Field for one (and each) specific row when it is used as Reference Input Field in a form (and you do not specify a custom Option Label).
Setting the default label
Setting the input field and leaving the Option Label empty
The result is showing the Default Lable
Fields are where the data-elements are stored. For example if you want to store information about an order, you may want to store information such as order number, order data, customer name, product ordered, price per product, number of products in the order, etc. Each of these items is a field in a list (for example in the "Order" list).
- Boolean (Yes/No)
- Single select (concept)
- Multi select (concept set)
- Date Time
- Duration (time-span)
- Number (numeric)
- Rich Text
When a new database list is created, two field are always created with the list:
ID: this is the unique identifier for a row in a list. This field is required and cannot be changed;
Last modified: this field contains the date of when a specific row is last modified. As with the
ÌDfield, you cannot change or delete the
To add a field to a list, right-click on the list and select
New fieldpop-up window. You can now select the type of field you want to add. The list is the same as the data types mentioned above. After you have selected the type of field you need, you get a popup where you can add additional information that is needed for the field.
A number of properties are available for all fields:
Name: The name you want to give a field;
Technical name: The technical name that WEM uses throughout the Modeler;
Save this field to the database: This checkbox is checked by default. In some cases you may want a field that you want to use temporarily so no data needs to be stored. But normally this box is always checked;
Default value: the default value that you want to give this field every time e new row for a list is added.
There are also a number of properties that are dependent on the type of field:
Validation: A number of pre-defined validation rules can be applied. For example when the validation
Max length: The maximum number of characters that can be stored in this field;
Minimum value: this is the minimum value this Numeric field will accept;
Maximum value: the maximum value this Numeric field will accept;
Validation: Allows you to select one (1) file-type that is allowed for this field. So if you want to store, let's say, only pdf files, you can specify that here;
Maximum file size: if the file that is stored can only have a maximum size, then you can specify that here. The file size is specified in kilobytes;
Allow access when: this is where you can restrict access to this field. You can define the access rule using the expression editor. This field is required when you create a
Filefield, and should be put to
Truewhen used without any constraints;
Depth: if a concept has multiple levels, you have the possibility to specify whether you only want to be able to select the direct children of the concept, or the children of all levels of this concept. Again, check the Ontology/Concept section for more information on 'concepts';
Only concepts with type: you can restrict the available concepts to concepts that have a specific type. Do this by selecting the particular type you're interested in;
Referenced list: a reference field refers to another list, so obviously you need to specify to which list this field is refering. Simply click on the button on the right-hand side of the field and a selection pop-up appears that enables you to select the list that that needs to be referenced to.
Editis used to change the properties of a field or list. To edit a field: select the field/list and click the
Moveis used to move a field/list to another list or folder . When a field/list is selected and
moveis selected, a popup appears where you can select the destination of the field/list;
Deleteis straightforward, thus will delete the field or list you have selected. When you do this, all data that is stored in the database will also be deleted.
Besides the regular fields, you can also add a
Calculated fieldto a list. A calculated field is a field that contains a value that is calculated. When you add a calculated field, the calculation needs to result in a data type that is the same as the data type of the calculated field. The calculation itself is defined using a WEM expression.
Every calculated field has the same properties:
Name: The name you want to give a field;
Technical name: The technical name WEM uses throughout the Modeler;
Type: The type that the expressions should yield as result (only available when creating a new calculated field);
Calculated value: this is where you enter the expression that specifies the calculation.
Find usagesbutton provides very useful information: it shows where the selected element is used in your application. When you need to change something or delete a field, you need to know where it is used. This is a simple way to find out whether that is possible, and even better, it allows you to go to the locations where an item is used if you want to change or delete it.