Object Reference and Table name reference
The main way to create relations between entities in Asta7 is by using Entity Structures (PK-FK relations). But sometimes it is not possible to create relations using entity structures. For example, creating entity structure relations between a project entity and a system entity is impossible.
To overcome this limitation there is another kind of relation in Asta7 which is called the Object Reference relation. This relation is created with a pair of fields with specific field features assigned to them. One field stores the related object’s AMID
and another field stores the object’s entity/table name.
Object Reference
In the template, we have objectReference
as a field feature, this field enables its Entity to have a reference to other entities. Example: `AKTOR_RELASJON` under Participant module → Aktor can refer to Project entities. To set a field as object reference, the field must be of type uuid
and objectReference
selected as feature.
Table Name Reference
In the template, we have another feature field tableNameReference
, this field works in conjunction with the objectReference
. When an object is selected for the relation that object’s AMID
is stored in the objectReference
field and the entity name of that object is auto-filled (from the UI) into the tableNameReference
field. The tableNameReference
field must be of type varchar.
Allowed Entity Names
By default, all project entities are applicable for the relations. This means that when selecting objects from the UI any project entity object can selected. No system entity objects can be selected. However, there is a property Allowed entity names
in the tableNamereference
field, through which it is possible to limit the selectable entities.
Multiple Relations
It is possible to have multiple pairs of these fields in the same entity. If there are more than one pair then the tableNameReference field’s name has to be prefixed with the objectReference field name followed by an underscore. For example, if the objectReference
field name is aktorRef
then the tableNameReference
field name has to start with aktorRef_
.