Design Example
 
 
  1
6
 
   
9
How do I avoid insertion of records into not null fields, when the option "none" is chosen?
   
 
Consider the following case where there are three tables named node, review and attribute. Node table is related to the other two tables via a linking table called conditional table. The tables are related to each other as shown here in the fig.
 
 
Conditional Table has two foreign keys AssignID and ReviewID referring to two reference tables. It also has got one more foreign key NodeID that refers Node table. Both the assignID and reviewID are Not null columns in the conditional table.
   
 
In a created custom UDM, node table is the topmost child. Conditional table is the child node of the node table.
 

                                                        Custom UDM Name
                                                                      |
                                                                      |___ node
                                                                                 |
                                                                                 |___Conditional 1
                                                                                               |
                                                                                               |___ ID
                                                                                               |___ AssignID
                                                                                               |___ ReviewID

 
While insertion, there may be a situation when you may not want to insert values into conditional table. Since AssignID and ReviewID are both not null fields, if you choose the option none(thinking that it will not insert any value) for both the fields, it will insert null values into those fields. But according to you, the fields should not have even a null value. This condition can be handled by changing the html and javascript files of the custom UDM. In the html file the option values in the Combo can be set to " ". Also wherever applicable the conditions can be checked with nullable being true. These changes will help the front end to execute without throwing error. With these changes records will not be inserted, if you try to make one field none and other with some other value. In such case you need to modify the not null property of the attribute in the database in order to insert value into one of the field.
 
 
  1
6