Skip to content

Commit

Permalink
Add Links + Init arbre docs / platform
Browse files Browse the repository at this point in the history
  • Loading branch information
alistairwheeler committed Feb 12, 2025
1 parent 735203d commit 38194eb
Show file tree
Hide file tree
Showing 38 changed files with 264 additions and 92 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Building the "Order Management" Training App : Creating a Business object

> Prerequisite : [A module, domain and group must be created before starting this lesson](/lesson/tutorial/getting-started/module)
> Prerequisite : [A module, domain and group must be created before starting this tutorial](/lesson/tutorial/getting-started/module)
## What is a Business object ?

Business objects are the cornerstone of the platform, structuring data, enforcing rules, and driving key features.... [Learn more](/lesson/docs/core/objects/business-objects)

## Creating a Business object

To create a business object, follow the steps below :
To create a Business object, follow the steps below :

1. Click **Creation assistant** in Business objects > Business objects
> This assistant is also available via the Modeler, for more information see the [How to create an object using the modeler](/lesson/docs/core/objects/business-objects#creation-assistant-via-the-modeler)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Building the "Order Management" Training App : Creating a Field

> Prerequisite : [A business object (TrnSupplier) must be created before starting this lesson](/lesson/tutorial/getting-started/object)
> Prerequisite : [A business object (TrnSupplier) must be created before starting this tutorial](/lesson/tutorial/getting-started/object)
## What is a Field ?

Expand Down Expand Up @@ -32,4 +32,4 @@ To create a field, follow the steps below :

The field **trnSupName** has been added to the object **TrnSupplier** and the template has the **Name** input visible on it.

# [Next step : Creating a test User](/lesson/tutorial/getting-started/user)
[Next step : Creating a test User](/lesson/tutorial/getting-started/user)
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Building the "Order Management" Training App : Creating a User

> Prerequisite : [A Business object with a field must be created before starting this lesson](/lesson/tutorial/getting-started/object)
> Prerequisite : [A Business object with a field must be created before starting this tutorial](/lesson/tutorial/getting-started/object)
## What is a User ?

Users belong to groups, and each user-group relationship is defined by a Responsibility. Groups are granted to Business object CRUD functions, in turn granting a User to a Business Object... [Learn more](lesson/docs/core/objects/user)
Users belong to Groups, and each user-group relationship is defined by a Responsibility. Groups are granted to Business object CRUD functions, in turn granting a User to a Business Object... [Learn more](lesson/docs/core/objects/user)

## Creating a User

Expand Down Expand Up @@ -57,6 +57,8 @@ You should now be connected with **usertest**
</ul>
</div>

[Next step : Adding objects to the Application](/lesson/tutorial/expanding/relations)

Troubleshooting
---------------------------
> These steps must be done using the **designer** user with **no active module filter**, see [Module filter](path/to/module-filter)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,6 @@ Follow the steps in [Getting started : Create field](/lesson/tutorial/getting-st
| **Name** | Short text | trnSupName | trn_sup_name | no | no |
| **Telephone** | Phone number | trnSupTelephone | trn_sup_telephone | no | no |
| **Logo** | Image | trnSupLogo | trn_sup_logo | no | no |
| **Website** | URL | trnSupWebsite | trn_sup_website | no | no |
| **Website** | URL | trnSupWebsite | trn_sup_website | no | no |

[Next step : Creating links between the Business objects](/lesson/tutorial/expanding/relations)
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"description": ""
},
"ENU": {
"title": "2.1.",
"description": "Add objects"
"title": "2.1. Add objects",
"description": ""
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"tags": ["lvl1"],
"display": "LINEAR",
"FRA": {
"title": "Créer relations",
"description": ""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,67 +1,49 @@
Creating links
====================
# Building the "Order Management" Training App : Creating links

Concepts
---------------------------
> Prerequisite : [The Supplier, Product, Client and Order objects must be complete before starting this tutorial](/lesson/tutorial/getting-started/object)
The definition of a 1:N relationship allows two business objects to be linked together. If we take the example of the supplier and the product, there is 1 supplier for N products. This section presents what the Simplicité engine does with the configuration of objects, attributes and relationships.
## What is a Link ?

### Technical key of the business object
A Link in Simplicité represents a relationship between Business objects. It is defined physically by a foreign key in the database and configured using an Object field... [Learn more](/lesson/docs/platform/business-objects/links)

From the definition of the physical object and attribute names, a table and a column are created in the database. In reality, as soon as a business object is created, 5 default columns are created, the **technical fields**. This can be verified by testing an SQL query via the "DB Access" shortcut as seen in the previous chapter:
## Creating a Link between Supplier and Product

```
select * from trn_supplier;
```
To create a link between the **Supplier** Business object and the **Product** Business object, follow the steps below :
1. In the **Business objects > Business objects** menu
2. Open **TrnProduct**
3. Click **Edit form** on the Business object's form (this will open the **template editor**)
<img src="edit-form.png" alt="edit-form" width="25%"/>
4. Hover over the **Field Area** and click on the `+`
<img src="field-area.png" alt="field-area" width="75%"/>
> For more information about Field Areas, see [Field Area](lesson/docs/core/objects/field-area)
5. Click **Business Object**
6. In the search box, enter **TrnSupplier**
<img src="search-supplier.png" alt="search" width="75%"/>
7. Check **Functional key ?** and **Required ?**
> For more information about Functional keys, see [Functional key](lesson/docs/core/platform/business-objects/fields#functional-key)
8. Click **Save**

We obtain the following columns:
The **Supplier Code** Joined field is added to the template.
> For more information about Joined field, see [Joined field](lesson/docs/core/platform/business-objects/fields#joined-field)

| row\_id | created\_dt | created\_by | updated\_dt | updated\_by | trn\_sup\_code |
|---------|-------------|-------------|-------------|-------------|----------------|
| | | | | | |
## Creating a Link between Product and Order

The `row_id` column is what we call the **technical key**. It is generated and managed by the base, **so there is no need to create ID attributes** for your objects.
To create a link between the **Product** Business object and the **Order** Business object, follow the steps below :
1. In the **Business objects > Business objects** menu
2. Open **TrnOrder**
3. Click **Edit form** on the Business object's form (this will open the **template editor**)
4. Hover over the **Field Area** and click on the `+`
5. Click **Business Object**
6. In the search box, enter **TrnProduct**
7. Check **Functional key ?** and **Required ?**
8. Click **Save**

These 5 columns are not intended to be visible to the user.
This will add the **TrnProduct** joined fields to the template, allowing the Order object to reference a product.

### Functional key of the business object
## Creating a link between Client and Order

The functional key is a set of fields defining the **functional** uniqueness of the business object. Thus, if we decide that the functional key of the customer is composed of his name and his first name, then we cannot have two customers with the same name + first name.
To create a link between the **Client** and **Order** business objects, follow the same steps as for linking **Product** to **Order**, with one key difference:

**Every business object must have a functional key**. *If there is no key, Simplicité will only allow the creation of one record, which will have an "empty" functional key. The second record, also having an "empty" functional key, will trigger an error because the functional key already exists.*
6. In the search box, enter TrnClient instead of TrnProduct.

### Foreign key

A link between two objects is defined:
- physically, by **a column in the referencing object's table**, pointing to the `row_id` column of the referenced object
- in terms of configuration, by:
- an attribute of type Internal ID/Technical Key (created automatically when the relationship is created),
- an object field with the following information :
- the object referenced in "Joined object"
- empty "referenced field"


### Joined fields

When there is a 1:N relationship between two objects, it becomes possible to add joined fields to the referring object. In our example, it is possible to display supplier information on the product form.

There are three ways to join fields:
- when creating the relationship between two objects
- by using template editor
- by manually creating a correctly configured object field

The joined field is defined:
- physically, by the joined object
- in terms of configuration by an object field linking **the joined object's field** to **the referencing object**, and containing:
- the referenced object in "linked object"
- the foreign key used in "reference field"


Exercise
---------------------------

- Create the following links, systematically joining the functional key of the referenced object:
- Supplier <-1:N- Product
- Product <-1:N- Order
- Customer <-1:N- Order
- Edit the order form and use the dedicated option to join a new field of a referenced object ("+" button on the template editor > Name of referenced object > )
This will add the **TrnClient** joined fields to the template, allowing the Order object to reference client information.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions content/CTG_50_docs/CTG_05_platform/CTG_10_project/category.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"FRA": {
"title": "Projet",
"description": ""
},
"ENU": {
"title": "Project",
"description": ""
}
}
10 changes: 10 additions & 0 deletions content/CTG_50_docs/CTG_05_platform/CTG_20_settings/category.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"FRA": {
"title": "Configuration",
"description": ""
},
"ENU": {
"title": "Settings",
"description": ""
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"tags": ["lvl1"],
"display": "LINEAR",
"FRA": {
"title": "Attribut",
"title": "Utilisateurs",
"description": ""
},
"ENU": {
"title": "Field",
"title": "Users",
"description": ""
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"FRA": {
"title": "Habilitation",
"description": ""
},
"ENU": {
"title": "Users and rights",
"description": ""
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"tags": ["lvl1"],
"display": "LINEAR",
"FRA": {
"title": "Utilisateur",
"title": "Liens",
"description": ""
},
"ENU": {
"title": "User",
"title": "Links",
"description": ""
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
Links
====================

### What is a Link ?

If the object has a form, the attribute will be a field of this form. The configuration of the attribute allows to determine if it is mandatory or not, its type (text, number, single or multiple enumerated) etc.

Just like a business object, the field has a logical and physical name. The logical name identifies the attribute in the business rules, in the code and will follow the same syntactical conventions as Java variables. The physical name will be used to create a column in the business object's table. A field might not have a physical name, it's the case for non persisted calculated fields.

We will now introduce you to a fundamental aspect of the metamodel: the **object field**. One field can be used on several objects: a "comment" field, for instance, can be used on the 300 objects of the app. If the size of this field needs to be increased, to allow the input of longer comments, it can be done by changing the parameters of one single attribute, instead of changing the 300 comment fields of our 300 business objects. Furthermore, a field doesn't have to be linked to an object (storage field for a planned task, process filed, etc). In the metamodel this concept is represented by a **N/N link between the field and the business object** therefore introducing a link object. In Simplicité, the link object between a business object and a field is called **object field**. The object field object allows to **override** the parameters of the attribute (mandatory, translation, etc).

When a field is linked to an object via an object field, Simplicité will create a column in the business object's table.

### Technical key of the business object

From the definition of the physical object and attribute names, a table and a column are created in the database. In reality, as soon as a business object is created, 5 default columns are created, the **technical fields**. This can be verified by testing an SQL query via the "DB Access" shortcut as seen in the previous chapter:

| row\_id | created\_dt | created\_by | updated\_dt | updated\_by |
|---------|-------------|-------------|-------------|-------------|
| | | | | |

The `row_id` column is what we call the **technical key**. It is generated and managed by the base, **so there is no need to create ID attributes** for your objects.

These 5 columns are not intended to be visible to the user.

### Functional key of the business object

The functional key is a set of fields defining the **functional** uniqueness of the business object. Thus, if we decide that the functional key of the customer is composed of his name and his first name, then we cannot have two customers with the same name + first name.

**Every business object must have a functional key**. *If there is no key, Simplicité will only allow the creation of one record, which will have an "empty" functional key. The second record, also having an "empty" functional key, will trigger an error because the functional key already exists.*

### Foreign key

A link between two objects is defined:
- physically, by **a column in the referencing object's table**, pointing to the `row_id` column of the referenced object
- in terms of configuration, by:
- an attribute of type Internal ID/Technical Key (created automatically when the relationship is created),
- an object field with the following information :
- the object referenced in "Joined object"
- empty "referenced field"


### Joined fields

When there is a 1:N relationship between two objects, it becomes possible to add joined fields to the referring object. In our example, it is possible to display supplier information on the product form.

There are three ways to join fields:
- when creating the relationship between two objects
- by using template editor
- by manually creating a correctly configured object field

The joined field is defined:
- physically, by the joined object
- in terms of configuration by an object field linking **the joined object's field** to **the referencing object**, and containing:
- the referenced object in "linked object"
- the foreign key used in "reference field"
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"display": "LINEAR",
"published": true,
"ANY": {
"ENU": {
"title": "Business objects"
},
"FRA": {
"title": "Objets métier"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
Fields
====================

### What is a Field ?

If the object has a form, the attribute will be a field of this form. The configuration of the attribute allows to determine if it is mandatory or not, its type (text, number, single or multiple enumerated) etc.

Just like a business object, the field has a logical and physical name. The logical name identifies the attribute in the business rules, in the code and will follow the same syntactical conventions as Java variables. The physical name will be used to create a column in the business object's table. A field might not have a physical name, it's the case for non persisted calculated fields.

We will now introduce you to a fundamental aspect of the metamodel: the **object field**. One field can be used on several objects: a "comment" field, for instance, can be used on the 300 objects of the app. If the size of this field needs to be increased, to allow the input of longer comments, it can be done by changing the parameters of one single attribute, instead of changing the 300 comment fields of our 300 business objects. Furthermore, a field doesn't have to be linked to an object (storage field for a planned task, process filed, etc). In the metamodel this concept is represented by a **N/N link between the field and the business object** therefore introducing a link object. In Simplicité, the link object between a business object and a field is called **object field**. The object field object allows to **override** the parameters of the attribute (mandatory, translation, etc).

When a field is linked to an object via an object field, Simplicité will create a column in the business object's table.

### Technical key of the business object

From the definition of the physical object and attribute names, a table and a column are created in the database. In reality, as soon as a business object is created, 5 default columns are created, the **technical fields**. This can be verified by testing an SQL query via the "DB Access" shortcut as seen in the previous chapter:

| row\_id | created\_dt | created\_by | updated\_dt | updated\_by |
|---------|-------------|-------------|-------------|-------------|
| | | | | |

The `row_id` column is what we call the **technical key**. It is generated and managed by the base, **so there is no need to create ID attributes** for your objects.

These 5 columns are not intended to be visible to the user.

### Functional key

The functional key is a set of fields defining the **functional** uniqueness of the business object. Thus, if we decide that the functional key of the customer is composed of his name and his first name, then we cannot have two customers with the same name + first name.

**Every business object must have a functional key**. *If there is no key, Simplicité will only allow the creation of one record, which will have an "empty" functional key. The second record, also having an "empty" functional key, will trigger an error because the functional key already exists.*

### Foreign key

A link between two objects is defined:
- physically, by **a column in the referencing object's table**, pointing to the `row_id` column of the referenced object
- in terms of configuration, by:
- an attribute of type Internal ID/Technical Key (created automatically when the relationship is created),
- an object field with the following information :
- the object referenced in "Joined object"
- empty "referenced field"


### Joined fields

When there is a 1:N relationship between two objects, it becomes possible to add joined fields to the referring object. In our example, it is possible to display supplier information on the product form.

There are three ways to join fields:
- when creating the relationship between two objects
- by using template editor
- by manually creating a correctly configured object field

The joined field is defined:
- physically, by the joined object
- in terms of configuration by an object field linking **the joined object's field** to **the referencing object**, and containing:
- the referenced object in "linked object"
- the foreign key used in "reference field"
Loading

0 comments on commit 38194eb

Please sign in to comment.