How can I implement relationship between my tables using Cellica Database?
Posted by Cellica Support Team on 18 June 2013 10:48 AM
We can achieve linking in two tables of the database as shown below in our application using "SubForm" Control.
Above relationship is for storing details of order in “Sample Order” Table in another table “Sample Order Details”
Create main form for Master table profile( Sample Orders). Put Subform on main form for Detail Table( Sample Order Details), create relation between main form profile ( Sample Orders) and sub form profile ( Sample Order Details) by selecting desired link fields.
You can create relations between forms and subform by mapping upto 4 fields between both forms. For above case map “Order ID” from “Sample Orders” with “Order ID” from “Sample Order Details”
You will get the related records for current order in subform.
For example, a doctor may have a database of Patient info, which would include a link field that linked to a Visits database. When the 'Visits' link button is pressed under a patient record in the 'Patient' database, the Visits database would be switched to, and would only show the visits that Patient had made.
How it can be done in Cellica Database:
“Patient Info” table will have “Patient ID” as primary key. And “Patient Visit” table will have “Patiend ID” as foreign key . Create main form on “Patient Info” table. Put subform for “Patient Visits” table and map “Patient ID” from both tables and linked field. Now when particular patient record is opened on main form corresponding visits will displayed in subform. Dr can add visit directly in subform.