Search through blog..

Wednesday, April 2, 2014

How to: Create a Relation

Use this step procedure to create a relation between the AJ_SubGenreTable and the AJ_BookTypeTable. The Sub-genre is related to the BookType table.

For example, the Sub-Genre 'Poems' can be only related to the record "Poetry" in the AJ_BookTypeTable table. You should not be able to have a "Novels" as Sub-genre for "Poetry".
To understand the example scenario - Gohere
To understand more details about types of relations: Gohere.
1. In the AOT, locate the AJ_EDTBookTypeID EDT.
2. Right-click the AJ_EDTBookTypeID EDT and select Properties.
3. In the ReferenceTable property enter AJ_BookTypeTable.
4. Close the properties sheet.
5. Expand the AJ_EDTBookTypeID node.
6. Right-click the Table References node and select New > Table Reference. A new table reference is created.
7. Right-click the AJ_BookTypeTable Table Reference and select properties.
8. In the related field property, enter AJ_BookTypeID
9. Close the property sheet and save your changes to the EDT.
10. If the database synchronization dialog appears, click Yes.
11. Drag the AJ_EDTBookTypeID EDT to the field node on the AJ_SubGenreTable
12. When prompted to add the ForeignKey relation from the EDT, click Yes. This will automatically create the relation between the AJ_SubGenreTable and the AJ_BookTypeTable.
13. Rename the AJ_EDTBookTypeID field to AJ_BookTypeID.



 
 
 
 
 
 
 
 
 
 
 
Note: Relations can also be added manually by right-clicking the relations node on the table.
However when you create the reference on the EDT and set it as a primary key, once the EDT is added to a table, the system will prompt to add the reference automatically.

No comments: