Relationships Repository (Magic xpa 4.x)
You can define relationships among tables in Magic xpa's Data repository.
To define relationships, you need to select the referenced or linked table, and select the relationship type to setup the type of relationship between the two tables.
Relationships tab contains the following fields:
|
|
#
|
An internal automatically generated number that represents the order of the Relation in Magic xpa.
|
Name
|
Relationship name. It is mandatory Alpha string of size maximum 100 characters.
|
Type
|
Relationship type. It can be One-to-One (1:1), One-to-Many (1:N), Many-to-One (N:1), or Many-to-Many (N:N).
|
Referenced Table
|
It is the name of the table with which you establish the relationship.
Default Reference Table number is 0. You can select a Referenced Table by pressing F5 on the 0.
|
Criteria Section
|
|
#
|
A generated number that represents the order of the criteria.
|
Current Table
|
Under Current Table, you can select either of the two criteria: a Column or a Variable.
Column: Default column is zero. You can select a Column number by pressing F5 on the 0.
Variable: Default variable is ???. You can select a variable pressing F5 on ??? from the Main Program.
|
Referenced Table
|
Under Referenced Table, you can select either of the two criteria: a Column or a Variable.
Column: Default column is zero. You can select a Column number by pressing F5 on the 0.
Variable: Default variable is ???. You can select a variable pressing F5 on ??? from the Main Program.
|
Consider the following three tables:
|
|
|
|
|
Department_ID
|
|
Employee_ID
|
|
Passport_Number
|
Employee_ID
|
|
Department_ID
|
|
Employee_ID
|
Department_Name
|
|
First_Name
|
|
First Name
|
|
|
Last_Name
|
|
Last Name
|
|
|
Date_of_Birth
|
|
Date_of_Issue
|
|
|
eMail_ID
|
|
Date_of_Expiry
|
|
|
Contact_Number
|
|
Place_of_Issue
|
1:N Relationship
Considering Department as Current table and Employee as a Referenced Table, a Department has many Employees.
N:1 Relationship
Considering Employee as Current table and Department as a Referenced Table, many Employees belong to a Department.
1:1 Relationship
Considering Employee as a Current table and Passport_Details as a Referenced table, an Employee can have only one passport.
|
-
Defining table relationships for XML is not supported.
-
Every new relationship with the Referenced Table is created automatically in reverse of the original/source relationship. Means, if the source Table to Referenced Table relation type is one-to-many (1: N), then the new relationship type for the Referenced Table will be many-to-one (N: 1) type.
-
Many-to-Many (N:N) relationship is not supported.
|
Since version: 4.7
Related Topics
APG with Table Relationships