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.

As long as a data record is referenced, it can be changed but not deleted.

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. Information on multilingual titles can be found here.

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

Click "Next".

Data fields

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

Click on "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, for example, a selection list can be linked to the reference on an input page.

To do this, simply select the "Values from references" option 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 now entered on the input page in the browser, all corresponding values from the referenced data field are displayed in the selection list 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 that are linked to reference fields are automatically filled with the values of the reference data group when a 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. Information on multilingual titles can be found here.

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

References to external data

In this example, an application in which customer data with orders, order items and products is managed is mapped with external data groups in a target application.

You can find out how to set up connections to external data here.

Information on integrating external data into applications can be found here.

The data structure is the same in both applications. A reference to the "Products" data group is set up in the "Position" data group in both applications.

To map the relationship between subordinate data groups and parent data groups using foreign data access, the foreign key must be defined in the subordinate data group.

Here you can see the properties dialog of the external data group "Order".

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 data field as a foreign key. 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.

Here you can see the properties dialog of the external data group "Position". The data field "fklid" is set as a foreign key. It contains the ID of the parent data record from the external data group "Order".

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.

The external data group "Product" is referenced on the "References" tab in the properties dialog of the external data group "Item". Click on "Edit reference" and then switch to the "Relationships" 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 specified for all Primary Keys in an Intrexx source data group, they will be added automatically when you leave the dialog page.

Make assignment

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 displayed 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 for references to external data groups: If the external data group originates from the Intrexx system database - the SysDB connection - the creation of references is usually possible, but only if the external data group is a physical data group. If the external data group is not the Intrexx system database, the reference is not possible.