SDMS allows the user to create relations between the tables of one dataset template. Sometimes, a table in your dataset template needs to have a reference to a specific value in another table of your template. For example, a table built to be filled later with a patients' test results, needs to have a reference to the patient's ID number, which will be stored in another table of this dataset template, detailing the patient's personal details. Relations are created using the Relations tab of the Dataset Prototype Editor window.
>> To create relations between the dataset template tables
1. | Follow the steps of the procedure in section Dataset Templates to create a dataset template and to add as many tables to it as needed. |
2. | In the relevant table, create a Primary Key Column. A primary column contains a unique value that you want to reference. This value cannot be changed, and it also cannot be null. To create a primary key column, select the relevant column from the columns list, and clear its adjacent Allow Nulls box. After that, click on the Key button, found on the columns' side bar, to mark your column as a Primary Key Column. |

3. | After creating a Primary Key Column in the relevant table, select a table from the Fusion tables list on the left-hand pane of the window, to which you would like to add a reference to your Primary Key Column. Then, click on the Relations tab. |
4. | Click the Add Relation button on the side bar; the Edit Relation dialog box appears. |

5. | If needed, provide the name for the relation in the Relation name field (otherwise, leave the name generated by the system). Then, select the table that contains the Primary Key Column from the Primary key table drop-down list. Note that the Foreign key table field displays your present table. |
6. | Click the arrow adjacent to the first line of the Primary Key Column to select the relevant Primary Key Column whose value you want to reference. |
7. | From the Foreign Key Column field, select the column whose value you want to contain the reference to the Primary Key Column. Note that all of the columns of your table can serve as Foreign Key Columns. |
8. | Click Add or Remove buttons on the side bar of the dialog box to add/remove other references, if necessary, and repeat steps 6-7. |
|