Configuring the resource’s data structure configuring-the-resource-s-data-structure
After creating a new custom resource, you must configure the data structure.
When editing the resource, in the Data structure tab, you can add:
Adding fields to a resource adding-fields-to-a-resource
You can add new fields to a resource to store data that are not part of the out of the box data model.
-
Use the Create element button to create a field.
-
Specify a label, an ID, a field type, and define the maximum length authorized for this field.
The ID field is mandatory and must be unique for each field added.
note note NOTE Use 30 characters maximum. -
To modify one of the fields, check the Edit Properties button.
-
In the Field definition screen, you can define a category that will be used for the audience and targeting, or even add a description.
-
Check the Specify a list of authorized values option if you need to define values that will be offered to the user (enumeration values).
Then, click Create element and specify a Label and Value. Add as many values as needed.
-
Once you have added your fields, check the Add audit fields box to include fields detailing the creation date, the user that created the resource, the date, and the author of the last modification.
-
Check the Add access authorization management fields box to include the fields stating who has access rights to that particular resource.
These fields appear in the data and metadata that can be displayed once the database update has been carried out. For more on this, refer to the Updating the database structure section.
-
Check the Add automatic ID field to automatically generate an ID. Please note that existing entities will remain empty. For more on this, refer to the Generating a unique ID for profiles and custom resources.
-
To modify the way in which the name of the resource elements will appear in the lists and creation steps, check the Customize the title of the resource elements box. Select a field from those you created for this resource.
note note NOTE If you do not check this option, the automatic primary key (which is automatically created each time an entity is added to the table) will be used when you list all the entities from this table.
The fields of your resource are now defined.
Defining identification keys defining-identification-keys
Each resource must have at least one unique key. For example, you can specify a key so that two products cannot have the same ID in a purchase table.
-
Specify it in the Automatic primary key section the size for the storage if you would like to have a technical key automatically and incrementally generated.
-
Use the Create element button to create a key.
The Label and ID fields are completed by default but you can edit them.
note note NOTE Use 30 characters maximum. -
To define the elements making up this key, click Create element and select the fields that you created for this resource.
Created keys are displayed in the Custom keys section.
Your identification keys for the resource are now created.
Defining indexes defining-indexes
An index can reference one or several resource fields. Indexes allow the database to sort records in order to recover them more easily. They optimize the performances of SQL queries.
Defining indexes is recommended but not mandatory.
-
Use the Create element button to create an index.
-
The Label and ID fields are completed by default, but you can edit them.
note note NOTE Use 30 characters maximum. -
To define the elements making up this index, select the fields from those that you created for this resource.
-
Click Confirm.
The indexes that were created appear in the list in the Index section.
Defining links with other resources defining-links-with-other-resources
A link details the association that one table has with other tables.
-
Use the Create element button to create a link to a target resource.
-
Click Select a target resource.
-
Resources are shown in alphabetical order and can be filtered by name. Their technical name is displayed in brackets.
Select an element from the list and click Confirm.
-
Select the Link type according to cardinality. Depending on the cardinality type selected, the behavior if the records are deleted or duplicated may vary.
The various link types are as follows:
- 1 cardinality simple link: one occurrence of the source table can have at most one corresponding occurrence of the target table.
- N cardinality collection link: one occurrence of the source table can have several corresponding occurrences of the target table, but one occurrence of the target table can have at most one corresponding occurrence of the source table.
- 0 or 1 cardinality simple link: one occurrence of the source table can have at most one corresponding occurrence of the target table or none. Note that this kind of Link type can cause performance issue.
-
In the New link screen, the Label and ID fields are completed by default, but you can edit them.
note note NOTE Use 30 characters maximum. It is not possible to rename a link after creation. To rename a link, you must delete it and create it again. -
The Category for the audience and targeting list allows you to assign this link to a category making it more visible in the query editor tool.
-
If needed, the Reverse link definition section allows you to display the label and ID of the resource in the targeted resource.
-
Define the behavior of the records referenced by the link in the Behavior if deleted/duplicated section.
By default, the target record will be deleted once it is no longer referenced by the link.
-
In the Join definition section, the default Use the primary keys to make the join option is selected but you can choose between two options:
- Use the primary key to make the join: This join definition allows you to use the profiles primary key to reconcile with the purchases’ primary key.
- Define specific join conditions: This join definition allows you to manually select the fields that will join both resources. Please note that if data are not correctly configured, the Purchase record will not be visible.