Article: AN0001879Updated: 15.04.2025
When using a special notation, a column of type Class Reference can be directly created in the query. Such a query can then be used in the master-detail relation of the given class and link the data from the query to the record detail in the class.
In referring to one class, we can have multiple situations that differ in syntax.
- Single reference to a class or user
- Multiple reference to a class or user
- Reverse reference (another class refers to our class, in which a new reference is automatically created)
We will show everything in the model example.
Entity-relationship diagram
These relationship types are described in the following diagram.

The combinations class refers to the classes on the left side of the diagram and to the person table (not shown in the diagram). There is stated after the column names in the combinations class, whether it is a multi-reference column, whether the referenced class is in a different model, or whether the reference is to the person table.
On the right side of the diagram, there are classes that, in turn, refer to the combinations class. In such a case, reverse references (virtual columns) are automatically created in the combinations class, which can also be used in the query. They display the records that refer to the combinations class. These virtual columns are, by their nature, multiple references to multiple records.
Overview of columns in the class.

The data in the class then looks like this: The two outermost columns are virtual (reverse references) and display the values ??found in the cases and tests classes that refer to the given record.

References to records in the query
We can display this data in queries by creating record link columns.
SQL query:
SELECT co.id,
co.name,
/*single record referencing*/
co.applicable_for_country AS applicable_for_country___countries,
co.default_plant AS [default_plant___basic:plants],
co.owner AS own___person,
/*multiple records referencing*/
co.id AS cust___combinations___applicable_for_customers,
co.id AS appr___combinations___approvers,
co.id AS case___combinations___cl_combinations,
co.id AS testing___combinations___cl_combinations_2,
co.id AS plant___combinations___preferred_plants
FROM {{:class.combinations:}} co
Reference to a single record
V první části SQL dotazu jsou tři sloupce vybírající data ze sloupců odkazujících se na jednu hodnotu. Uvedeme daný sloupec (např. co.applicable_for_country) za klíčovým slovem AS námi zvolený prefix kódu sloupce dotazu, který má vzniknout (např. applicable_for_country), pak tři podtržítka a kód třídy, na níž se odkazujeme. Pokud se tato třída nachází v jiném modelu, musíme dát celý řetězec za klíčovým slovem AS do hranatých závorek a před kód třídy přidat ještě kód modelu s dvojtečkou jako oddělovačem (např. co.default_plant AS [default_plant___basic:plants]).
In the first part of the SQL query, there are three columns that select data from columns that refer to a single value. We list the given column (e.g. co.applicable_for_country), after the keyword AS, the prefix of the query column code we have chosen to create (e.g. applicable_for_country), then three underscores and the code of the class we are referring to. If this class is in another model, we must put the entire string after the keyword AS in square brackets and add the model code with a colon as a separator before the class code (e.g. co.default_plant AS [default_plant___basic:plants]).
Reference to multiple records
In the second part of the SQL query, there are links to multiple records. They always have the same structure, whether they are in a different model, a link to the person table, or reverse links. We always specify the ID of the record from which or to which the links lead, the keyword AS, followed by the selected prefix of the query column code that is to be created, then three underscores and the code of the class to which the link should point, three underscores again and the code of the column of the given class in which the records are located.
The resulting overview of the records in the query then looks like this. We can verify that it corresponds to the values ??from the class.

If we view the query columns, we see that they are indeed of type Reference to another class.

In the query details, we can then set the sorting of records, the way multiple links are displayed, etc.