You are viewing an old version of this page. View the current version.
Compare with Current View Page History
« Previous Version 24 Next »
What is REM?
To answer this question, we need to provide some theory first.
Thesis 1
In SimpleOne, you can handle with data which is represented as records in tables that have a specified attribute set. Records appear in tables and they have these attribute values given.
Thesis 2
Every table has its own data model stipulated by the business-logic. The data model is represented by the column set (their amount, types, links with another system objects, and so on). This data model can be extended with child table with the same attribute set as a parent one, and an individual attributes inaccessible from the parent table, as an addition.
Attributes extension circuit diagram
Conclusion
To manage the commonalous entities (like ITSM Tasks), we can create a table with appropriate column set and extend from it for Incidents, Change Requests, Problems, and so on, creating respective tables that inherit attributes (columns) from a parent one and besides have their own attributes. For example, attribute overlap in there may be 70%, and unique attributes will be 30% of the total.
In this case, this model works fine (when we do not have many child tables, and the attribute overlap is high). But when the child table number increases, and the attribute overlap decreases, the management of this data model becomes a challenge. Data model with big and complicated table inheritance structure has some disadvantages:
- It is required to allocate more space for record storage.
- Scripts are executed slower
- It is getting harder to configure еру functionality related to the specified dictionary, such as data import, layout setting and so one.
A Request Catalog can be taken as an example of such a table (a parent table for the catalog and a record in the table for every request template with specific attributes).
To deal with this issue, another concept has been created and implemented - Record Extended Model.
REM Concept
In this concept, extension concept can be applied for a specified table record giving some featured attributes to it.
Physically, extension model are stored as records of the Models (sys_re_models) table, and they intended to collect specific attributes extending records. Attributes are stored as records of the Attributes (sys_re_attribute) table (extending the Columns (sys_db_column) table).
When a record extension model is applied to a record, it means that an auxiliary record set is created for this record containing information about specific attribute values. So the record has attributes inherited from a table, and in addition, it has attributes sourced from the extension model.
Configuring extension models
Generally, to configure your extension model, you need to:
- Create an extension model.
- Create attributes (and link it to the model).
- (optional) Configure an attribute collection.
- Configure RE client script if needed.
Creating models
To create a model, please complete the steps below:
- Navigate to Record Extended Model → Models.
- Click New and fill in the fields.
- Click Save or Save and Exit to apply changes.
Record extended model form fields
Field | Mandatory | Description |
---|---|---|
Name | Y | The model name. |
Title | Y | The model title. Can be specified in a language other than English. |
Table | Y | Reference to a table affected by the model. Please note that you cannot specify a read-only table. To use such a table, please turn off this attribute first. |
Description | N | The model description. |
After insert script | N | Specify a script that should be executed after a record is created. Develop it using JavaScript extended by the SimpleOne Server-Side API and Client-Side API methods. |
Active | N | Select this checkbox to make the model active or inactive. |
Icon | N | Reduced image intended for the model identification. |
Related lists | ||
Attribute | List of the RE attributes linked to this model. | |
Model client script | List of the RE client scripts linked to this model. | |
Model form element | List of the RE model form element linked to this model. |
Configuring attributes
To create an attribute, please complete the steps below:
- Navigate to Record Extended Model → Attributes.
- Click New and fill in the fields.
- Click Save or Save and Exit to apply changes.
Attribute form fields
Field | Mandatory | Description |
---|---|---|
Container | Y | Reference to a previously created model. |
Column Type | Y | Specify a column type. |
Title | Y | An attribute title. Can be specified in a language other than English. Latin, Cyrillic letters, [0..9] numbers and the underscore symbol ( _ ) are allowed. |
Column Name | Y | A column system name. Latin letters, [0..9] numbers and the underscore symbol ( _ ) are allowed. |
Map to Column | N | Specify a target field to map the attribute value after the record is created. This option allows nimble transferring of the attribute values to fields. Please note that if the target field is mandatory, then the value is saved before it is processed by server validation engine. Also, if the target field is mandatory, it should be not displayed on the form, otherwise the client validation engine may hamper the record saving. |
Comments | N | Put here some comments describing your attribute. |
Active | N | Select this checkbox to make the attribute active or inactive. |
Read Only | N | Select this checkbox to make the field adding by this attribute read-only. |
Mandatory | N | Select this checkbox to make the field adding by this attribute mandatory. |
Full text search | N | Select this checkbox to make the field adding by this attribute indexable. |
Display by Ref | N | Select this checkbox to make the field adding by this attribute display its displayValue instead of a value (see the Display by ref description for more information) |
Unique | N | Select this checkbox to make the field adding by this attribute unique. |
Type Specification tab | ||
Max Length | N | (For the columns that have a String or Text type) Specify a maximum value length for this column. The value length cannot exceed allowable length for the specified data type. |
Default Value tab | ||
Default Value | N | Specify a default value that will be populated to the field when creating a new record. This field may be specified by a Javascript scenario as well. |
Use Dynamic Default | N | Select this checkbox if you want to generate the default value dynamically. |
Dynamic Default | Y | This field appears only when the Use Dynamic Default attribute is set to TRUE. Select the script from the Dynamic Default Values (sys_default_value_dynamic) dictionary, so its execution result will be automatically calculated and entered into this field; this value will be the default value for the column specified.
|
Configuring attribute collections
Attribute collections are implemented for using Many-to-Many Relationships so they allow reusing the same attributes in various models instead of adding them in every model where necessary.
A simplified usage concept is:
- Create a collection record as described below
- Fill it with previously created attributes or create new ones using the Attributes related list.
- Relate this collection with previously created models using the Used in Models related list.
After that, all attributes contained in this collection are used by all models this collection related with.
To create a collection, please complete the steps below:
- Navigate to Record Extended Model → Collections.
- Click New and fill in the fields.
- Click Save or Save and Exit to apply changes.
Collection form field
Field | Mandatory | Description |
---|---|---|
Title | Y | Specify a collection title. |
Active | N | Select this checkbox to make the collection active or inactive. |
Related lists | ||
Attributes | On this related list, you can create a new attribute related to this collection or select an existing one from dictionary. | |
Form Elements | On this related list, you can create a new form element related to this collection or select an existing one from dictionary. | |
Used in Model | On this related list, you can create a new model related to this collection or select an existing one from dictionary. | |
Client Scripts | On this related list, you can create a new model client script related to this collection or select an existing one from dictionary. |
Configuring model client scripts
To create a record extended model client script, please complete the steps below:
- Navigate to Record Extended Model → Model Client Scripts.
- Click New and fill in the fields.
- Click Save or Save and Exit to apply changes.
Model client script form fields
Field | Mandatory | Description |
---|---|---|
Name | Y | Client script name. |
Table | Y | Reference to a table affected by a model. |
RE model | Y | Reference to a previously created model. |
Type | Y | The script type:
|
RE attribute | N | Reference to a previously created model attribute. This field is mandatory. |
Description | N | Client script description. |
Active | N | Select this checkbox to make the script active or inactive. |
Order | N | Client script execution order. Scripts are executed in ascending order. |
Script | N | Specify a client script. Develop it using JavaScript extended by SimpleOne Client-Side API methods (the SimpleForm class). |
How to use record extensions
For a full record extension functionality using, some additional actions are to be fulfilled. Below, a simplified implementation procedure can be found.
- Create an extension model as described above.
- Create necessary attributes and bind them to the model.
- You can create attributes out of the your created model using the appropriate related list.
- Create a new widget using <rem> or <remform> SimpleTags (based on the widget planned location, a record form or a portal page).
- Add newly created widget to a record form using the Form Layout functionality (or add it to the appropriate portal page using the portal pages configuring functionality).
Example of usage
For example, you need to extend your Task table with some attributes allowing to handle some daily duties. To perform this, follow the procedure described above:
Create an extension model for this table.
Create attributes (wonder which fields could be created on this record form within this task). There should be a single attribute for every single for field.
Create a form widget as described below and save it:
<rem modelId="{data.model_id}" tableName="{data.table_name}" recordId = "{data.record_id}" />
(() => { window.s_widget_custom = window.s_widget_custom || {}; const parameter = new URLSearchParams(window.location.search).get('model_id'); s_widget.setFieldValue('model_id', parameter); s_widget.setFieldValue('table_name', window.s_form.getTableName()); s_widget.setFieldValue('record_id', window.s_form.getUniqueValue()); })();
Add this widget to the record form view using the Form Layout functionality:
Navigate to a record form using the URL looking like: https://instance.example.com/record/task?model_id=XXXXXXXXXXXXXXXXX
In this URL. you need to substitute the X's with the model ID you are using in this case. To know it, please complete the steps below:
- Navigate to Record Extended Model → Models.
- The model ID can be found in the ID column of the list displayed (if this column is absent, then let it display using the List layout functionality).
Without using this URL addition, a non-extended form is displayed.
After that, a form containing fields defined by attributes bound to the model specified is displayed.
- No labels