Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- dBsee 4.6 - The Library - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

   The need for creating a N:1 or LookUp relation on a specific field comes
   about in all those cases where the data contained is to be looked up and
   verified against data in another database file, and where additional
   information is associated to that data. For instance, a N:1 relation is
   used when printing the invoices of a customer, and using the customer's
   code in the invoice to retrieve the customer's data.

   A N:1 relation can be seen as the inverse of a 1:N relation. In dBsee,
   though, setting a N:1 relation does not create the corresponding 1:N
   relation. If the inverse relation is desired (the referential integrity
   rules only apply to 1:N relations), it must be created separately.

Example:

   Let's consider a database example and evaluate the importance of the
   relations that can be set.

1:N relation between InvHea and InvRow

     . A sub-group of records in InvRow is logically linked to a
       InvHea's record.

     . When a record is added to the InvRow file, the invoice code
       is "inherited" from the header file (InvHea->InvCod) so that it gets
       entered only once.

     . The 1:N relation creates optimised search parameters to be
       used in the Browse (List box control).

     . When a record in the InvHea file is deleted, all the records
       in relation to in in the InvRow file will be deleted (CASCADE option
       for the integrity when deleting).

N:1 relation between InvHea and Cus on field CusCod

     . In edit on the invoice header with the active input on the
       CusCod field, all the automatisms made available by the lookup
       (control, search window) are wanted.

     . When a Customer Code does not exist, it is possible to
       insert it directly from the invoice.

     . When the invoice list is displayed, it is possible to have
       the company name of the client displayed aside. By only using the N:1
       relation between the InvHea and Cus files, and adding the Cus->CoName
       field into the display window, the application will provide to align
       the customer file with the invoice header so that the correct customer
       will be displayed.

N:1 relation between InvRow and Cus on field CusCod

     . A redundancy has been introduced expressely (as can be seen,
       the Customer code is duplicated in both the InvHea and InvRow file).
       The Customer code on the details file is used for displaying the
       articles invoiced to a customer. In this case, the N:1 relation is not
       used for data entry (the CusCod will, in practice, be edited only on
       the invoice header and then 'inherited' to each InvRow), but instead
       it is entered in order to make the name of the customer available when
       building a search window on the InvRow file.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson