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]

   A file A is in a N:1 relation with a file B when each record of
   file B, whose main key is an expression derived from file A, has
   one or more records of file A corresponding to it. This relation is
   also called Lookup relation.

   When organising the database's files, you may need to save, in specific
   fields, coded information that will be used to reference information
   present in other files.

   If during the definiton of the file's structure, a field (symbol) is
   added, to which a Lookup relation has been associated previoulsy in
   another file, the system will ask if the same relation must be inherited,
   too. If yes, the relation is added, otherwise, the system will not create
   the relation between the current file and the lookup file.

Example:

   In the following example the Many to One relation between the Invoice
   Detail Rows file (InvRow) and the Articles file (Art) on the relational
   field Article Code (ArtCod) can be seen.

   For each invoice row, it is possible to identify a single record in the
   articles file having as a primary key (ArtCod) the value contained in the
   ArtCod field of the InvRow file. More than one row of the invoice can
   refer to the same article, but only one article can correspond to each
   invoice row.

   It often happens that the information contained in one file (in this case
   the Articles file) must be available for more than one file. This
   corresponds to extending the N:1 relation to all the files that, like the
   InvRow file, have the ArtCod field in their file structure.

   As discussed at the beginning of this paragraph, the duplication of the
   N:1 relation on these files can be done automatically by dBsee. In the
   Services environment, under the User option, you can find the
   parameter that establishes whether or not a relation set on a field is to
   be inherited automatically in all the places that the field is used.

Example:

   If automatic inheritance is chosen, after having defined the relation
   between Invoice Rows and Articles on the Article Code field, if in another
   file (ex. Waybill Rows) the ArtCod field exists, the same relation will be
   created.

   The definition of a Many to One relation activates, in the generated
   application, many automatisms:

     . Existency Check on the lookup file.
        When a value is entered into a field, the existence of such a value
       is verified in the Lookup file and if it does not exist, an error
       message is given. In this case, it is possible to directly insert the
       missing record in the lookup file using the associated data entry
       frame.

     . Search window on the lookup file.
        When entering code, a search window (pick-list) is available making
       it possible to examine the contents of the Lookup file and directly
       choose the desired value.

     . Update screen/report.
        When a data entry frame, window or report is set, it is possible to
       include fields coming from files that are in a Lookup relation with
       the main file of the object. The synchronisation of the lookup file
       and the displaying of the fields is managed automatically by dBsee.

   To set up a lookup relation, it is necessary to specify some parameters.
   The values of these parameters are set by default by dBsee, but can be
   accessed when pressing the Options button from the relation definition
   frame.

   The parameter values can be edited by pressing the Space Bar,
   Enter or double-clicking.
    The Alt-1 keys will build the expressions interactively.

     . The relation key that represents the expression to search
       for in the Lookup file.

     . The Lookup mode that defines whether the insertion of data
       in a field will be mandatory or optional. The values allows are:

 +--------------------------------------------------------------------------+
 | Lookup mode                     | Example                                |
 ----------------------------------+----------------------------------------|
 | Allows empty key.               | It is possible to leave the Customer   |
 |  The foreign key MUST exist     | Code field empty; any value inserted   |
 |                                 | must exist in the Customers file.      |
 | May NOT be empty.               | It is not possible to leave the        |
 |  The foreign key MUST exist     | Customer Code field empty; any value   |
 |                                 | inserted must exist in the Customers   |
 |                                 | file.                                  |
 | May be everything.              | It is possible to insert any value     |
 |  The foreign key MAY exist      | even if it does not exist in the       |
 |                                 | Customers file. The only link with the |
 |                                 | Customers file is the possibility to   |
 |                                 | open a pick-list and selecting the     |
 |                                 | Customer Code.                         |
 +--------------------------------------------------------------------------+

     . The name of the search window to activate for the
       consultation of the file during Lookup. This name is inserted directly
       in the relation definition frame. The F7 function key allows to
       display and eventually select already defined windows.

     . The primary positioning key of the data displayed by the
       search window. If it is empty, the system will generate a null string
       equal to GO TOP.

     . The filter expression that allows to limit the data
       displayed in a search window. If no expression is entered, the value
       .T., equal to everything, will be entered as default.

     . The Break expression to abort the scanning of the lookup
       file when displaying records within a search window. If this option is
       left empty, the system will insert the value .F., equal to display
       all.

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