Step 2: Create a “1 to Many” relation
Last updated
Last updated
To create a 1 to Many relation between the Customers and Activities entities, go to the Entities page and open the settings for the Entity “UserName_Acc_customers”.
To define the relations in the Entity “UserName_Acc_customers”, click on the “Relations” tab.
To create a new relation, click on the [+ Relation] button.
To create a one-to-many (1-to-M) relation between “UserName_Acc_customers” and “UserName_Acc_Activities”:
Enter Relation Name “Customer_Activities”.
Select Relation as “One-to-Many”.
Select Related Entity as “UserName_Acc_Activities”. This relation defines that “UserName_Acc_customers” will be the parent Entity and “UserName_Acc_Activities” is the child Entity. One record in the parent Entity can be associated with multiple or many records in the child Entity.
“Customer_ID” is selected by default from “UserName_Acc_customers” as it contains the primary key.
Select “Customer_ID” in related entity “UserName_Acc_Activities”. Points (4) and (5) indicate that the relation is established based on the common field “Customer_ID” for both entities. Relations are defined through the entity's primary keys only.
Select “Cascade delete”. This option indicates that if a record in the parent entity (on the left-hand side of the relation) is deleted, then the corresponding related records in the child entity (on the right-hand side of the relation) will automatically be deleted. No orphan child records remain when the parent entity record is deleted.
To save the fields, click the [Save] button.
To finish, click the [Close] button.