References

Data from other data groups (including data groups from other applications) can be easily referenced in Intrexx.

Referenced data can only be changed via the data group from which it originally originated.

Referenced data is automatically updated in the data records of the referencing data group when changes are made in the original data group.

Please note that although you can create edit elements that show reference data, the values that are entered by users into these elements will not be saved.

If the referenced data group is changed, the internal reference field is regenerated. Data record IDs that have been entered for the previously referenced data group will thereby be lost.

If a data record is referenced by a third-party application, the record cannot be deleted until the reference is removed.

Here you can see the structure of an application in which references are used.

Categories are recorded in the data group "Category" (1). These categories should be assigned to the values in the data group "Value" (2).

For this purpose, a reference to the "Category" data group is created in the "Value" data group. On the "Values" input page from the "Value" data group, a selection list offers the categories from the "Category" reference field for selection.

Here you can see the input page in the browser.

Create a reference

A reference can be created via the main or context menu "New / References" if a data group is selected in the application structure.

They are then located in the properties of the data group on the "References" tab.

The reference can be created by clicking on "Add reference".

General

Enter the title of the reference here. Click here for information on multilingual titles.

Select the application and data group whose data is to be referenced.

Click on "Next".

Data fields

Move the desired data fields from the "Available" column to the "Selected" column.

Click "OK" to save the changes and close the dialog again.

An existing reference can be deleted here by clicking on "Delete reference". "Edit reference" opens a dialog in which the currently selected reference can be edited.

Connect reference with element

Now, a drop-down list could be connected to the reference on an edit page, for example.

This is done by selecting the option "Values from references" on the "Entries" tab.

The desired data field from the reference (here e.g. "Category") can then be set as the display value. If a new data record is entered on the edit page in the browser, all of the corresponding values from the reference data field will be shown and can be selected.

The data in the list is always up-to-date because any changes made in the reference data field will be shown in their latest state when a new data record is being created (i.e. when the edit page is loaded). Changes in the referenced data group are also updated in the data records that have already been created here.

The reference is created using the data record ID of the referenced data record. All elements, which are linked to reference fields, will automatically be filled with the values of the reference data group when the data record is saved.

Reference data field - properties

You can access the properties dialog of a reference data field via the application structure.

The title of the reference data field can be edited here. Click here for information on multilingual titles.

The name and data type of the reference data field are displayed below this.

References to external data

The following example shows how an application, where customer data is managed with orders, order items, and products, is represented in a target application using external data groups.

Click here to discover how to create connections to external data.

Click here to discover how to integrate external data into applications.

The data structure is the same in both applications. The "Item" data group contains a reference to the "Products" data group in both applications.

To represent the relationship from child data groups to parent data groups using external data access, the foreign key must be defined in the child data group.

The properties dialog of the external data group "Order" is shown here.

The data field "fkstrid" is set as a foreign key. It contains the ID of the parent data record from the external data group "Customer".

Click on Foreign key to define a field as the foreign key field. The field used as a foreign key must contain a value that can be used to uniquely identify a parent data record, such as a customer number.

The properties dialog of the external data group "Item" is shown here. The "fklid" field is set as the foreign key. It contains the ID of the parent data record from the "Order" external data group.

The data field that is used in the source application as a foreign key for referencing the data record from the "Product" data group must not be included here in the data field list.

References

The "References" tab can be found in the properties dialog of external data groups. All existing references to other data groups are listed here.

"Add reference" opens a dialog in which a new reference can be created. "Edit reference" opens a dialog in which the currently selected reference can be edited. "Delete reference" removes a reference from the list.

In our example, the relationship to a reference data group is defined via a foreign key whose values are compared in both data groups. In general, the values of the foreign key correspond to the primary key of the referenced data group.

In the properties dialog of the external data group "Item", the external data group "Product" is referenced on the "References" tab. Click on "Edit reference" and then switch to the "Relations" tab.

Relationships

The primary keys of the referenced data group with the assigned foreign keys are displayed here. This dialog will only be displayed when creating a reference if the source data group is an external data group or an Intrexx data group with more than one primary key. If assignments are not defined for every primary key for an Intrexx source data group, these will be filled in automatically when you leave the dialog page.

Select foreign key

If you create a new reference, a dialog can be opened here by clicking on "Make assignment". The foreign keys can be assigned there as long as the reference has not yet been completely created.

For our example, the reference field, which contains the ID of the referenced product, is entered here as a foreign key for the relationship to the external data group "Products". Thus, every time an order item is created, the product ID is automatically saved to this reference field as well.

Select foreign key

Primary key

The primary key data field selected in the previous dialog is shown in this field.

Foreign key

Fields from the user administration, static values or session variables can be selected as foreign keys.

The "Data field" option can be used to select a reference data field whose unique value is then used as a foreign key to identify the corresponding data record.

External data groups which come from the Intrexx standard connection can also reference any standard data group. When integrating external data tables, the integration of

  • multiple primary keys

  • multiple foreign keys

  • mixed primary and foreign keys

is not possible. Certain conditions apply to references to external data groups: If the external data group originates from the Intrexx system database - the standard connection "SysDB" -, creating references is usually possible, but only if the external data group is a physical data group. If the external data group does not relate to the Intrexx system database, then the reference is not possible.