- First question
I have following entities: Form which can have some Parameters(but not necessarily), Form has Tables. In one case(if Form has no Parameters) i know advance what Tables correspond to the Form, in other case (if Form have Parameters that the user chooses) I decide which Tables to load depending on choosen Parameters.
How i can store this information in database?
[Update] At this moment i have following schema: table Form, table FormParam, table Table; Form has relation to FormParam(one-to-many), Form has relation to Table(one-to-many); but in this schema doesn`t exist information about the dependence of Table from FormParam. I can do relation from FormParam to Table, but in my case not all situations Table depends from FormParam.
- Second question
I have one table which contains some data (catalog of organizations). In another table i have data which will be selected by user from Form. In some Forms user must choose organization from list of organization. I want uniformity of data storage that a user selects from a Form, so i can duplicate records from the first table in the second, but i don`t want( i think this is bad style).
How should I to do in this case?
[Update] Perhaps there is a solution in such a way to design a DataBase that I can specify a first table to refer to records stored in another table. Maybe I’m wrong.
Thank you!
I believe that you need to spend some time designing your system’s data model. Maybe your approaching would be changed from the “operating” to “data” itself.
To solve your problem now, you can create tables in N x N relation, where in table A you have the Form information and table B you have parameter information. In the 3rd table, NxN relation, you specify the properties that should load the desired tables (that would be stored in a string field in this table).
Be care about the complexity of your params. If you have many differend combinations, maybe you have too many records and to implement the table loading would be almost impossible.