N:N – The N:N relationship (many-to-many) have a caracteristic different of the others. In the case, the date are relationed directly at the fact, and not at the entitys.
Importantly, there can be no association of facts in situations where relationships are conditional character. In this case, the cardinality must be determined through a comprehensive analysis of the possibility of relationships occur.
Rules of N:N Relationship – To establish this kind of relationship, we have three tables, and the third is responsible for the other two relate. For this it is necessary that these first two tables contain a column which is primary key.
The columns that are primary keys in the first and second table should be columns with foreign key in the third. Thus, this table will have two foreign keys, which form a composite primary key. See the picture below:
In the Scriptcase
Have a option in the form application called: N-N Relations, e this option sta opção allows you to configure automatic update link tables in N:N Relationship.
After choose the option "New Actualization", the screen below will be display:
This link is treated as a field in the Form application.
Define Field name, Data type, Label and specific Connection for this link. For specific connection is displayed a select with the project available connections.
Define the select (lookup) data source. Enter a select command or base it on a table.
For the option Choose Table 3 objects select are displayed allowing to choose the table and the fields Key and Description.
- Key - Value stored in the relationship table.
- Description - Value displayed in the update field.
Select Command to display the update field values available.
Define the update display format.
- Display key and description - Display the key and the description entered in the select command.
- Display Title - Display the relationship attribute title. (see relationship attribute).
- Separator - Define a delimiter between key and description when the option selected is Display key and description.
- Object - Lookup object type to display in the form. Available types: Select, Double Select, Checkbox and Radio.
- Check and Uncheck all - Enable an option to check or uncheck all values( available only to Checkbox).
- Columns - Define number of columns displayed (available only to objects Checkbox and Radio).
Define the relationship table updated.
Define the application fields related to the relationship table fields.
Define the lookup table field related to the relationship table.
Define the values stored in the relationship table fields that are not foreign keys.
Attribute - Store an application field value.
Search ( only for Double Select )
Define a search to the relationship table.
- Limit of Records - Maxim quantity of records return by the search.
- Initial State - Define the object load state.
- Search fields - Define search fields (Key and/or Description) to display.
Display Settings ( optional )
Define relationship field display settings such as CSS field attributes, title and object..
Document the application. Create on-line instructions, describe business rules and save comments in the System Help to allow users to better understand the system and instruct them in the best way of interacting with the applications.
- Tooltip - Add text that will be displayed when the user hovers his mouse over the field.
- Pop-up - Displays the help text in a pop-up window when the help icon displayed beside the field is clicked.
- Hint - Displays the help text in a hint window when the mouse cursor hovers over the field.
- Text - Display the specified help text beside the field.
The application in execution: