![]() | |||||||||||||||
Index
IntroductionWith the help of Many-to-Many Relational Fields you can create relations between recordsets. What does it mean? For example, you want to create a database of books. To do this, you would need to create two types of records, i.e., Book and Author. Since each book may be written by several authors, and each writer may be the author of several books, you would need to set a conformity between the recordsets of the Author type and of the Book type. Below is a graphical illustration of this process:
According to these relations, the user can affirm that:
Or, in a different way:
Establishing such relations allows you to get the answers to the following questions:
In exactly the same way, you can connect more than two types of records, such as Products, Customers and Orders. Step-By-Step Many-to-Many Relational Database CreationThis section contains a detailed instruction of how to create the Books and Authors database described above. 1. Switch to the Form Editor mode. 2. Create the Book form and then place the following elements on it (see the Form Editor section):
It is also recommended to give some space for the many-to-many relational field Authors. 3. Create the Author form and place the following elements on it:
When creating the Books field, the program will ask you:
Use the following formulas to extract data from a relational field when creating mathematical fields:
4. After that, return to the Book form, and add the Authors field, specifying the Book form as a source:
Nothing depends on order in which the relational fields are created. Moreover, information about connections between records is stored in the record itself, not in the relational field. I.e. If a relational field is deleted, the connection between records does not disappear. Working with the Many-to-Many FieldAfter the forms are created, close Form Editor and switch back to the database mode. There are two ways to connect two records (add a record to a relational field):
Accordingly, to delete a connection between 2 records, you should right-click the record in the relational field, and then select the Remove selected item menu item:
As stated above, relations between the records are equivalent, which means that it does not matter either you add authors to a book description, or you add books to an author description, the result will be exactly the same. The same way is also appropriate for deleting relations. The contents of the many-to-many fields can be changed by using scripts. View example. Many-to-Many Relational Field Properties
What is Relational Set?For example, you want to distinguish between two types of authors for a book: the major authors and minor authors. For this purpose you will need two many-to-many fields in the book form. One of the fields will store the major authors, while the other field will store minor authors. To make each of these fields independent of each other, you have to define different Relational Sets for them. This can be done on the Individual Properties tab of the field. By default Relation Sets have standard names Primary, Secondary, etc, but for convenience we will rename them into Major Authors and Minor Authors. Now the relations structure will look as follows: Now, when you work with the many-to-many field, you will have an additional option at your disposal: Move selected to - this action moves records from one mmr field into another.
In our case using this action you can move an author from the Major Authors field into Minor Authors, and vice versa.
| |||||||||||||||
|
Copyright (C) 2001-2010 Binary Brilliant Inc. All Rights Reserved. |