Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is no simple, generic solution to a complex, meticulous problem. You can't have both simple storage and simple app logic at the same time. Either the database structure must be complex, or else your app must be complex as it interprets the data.</p> <p>I outline five solution to this general problem in "<a href="https://stackoverflow.com/questions/695752/product-table-many-kind-of-product-each-product-have-many-parameters/695860#695860">product table, many kind of product, each product have many parameters</a>."</p> <p>For your situation, I would lean toward <strong>Concrete Table Inheritance</strong> or <strong>Serialized LOB</strong> (the XML solution).</p> <p>The reason that XML might be a good solution is that:</p> <ul> <li>You don't need to use SQL to pick out individual fields; you're always going to display the whole form.</li> <li>Your XML can annotate fields for data type, user interface control, etc.</li> </ul> <p>But of course you need to add code to parse and validate the XML. You should use an XML schema to help with this. In which case you're just replacing one technology for enforcing data organization (RDBMS) with another (XML schema).</p> <p>You could also use an RDF solution instead of an RDBMS. In RDF, metadata is queriable and extensible, and you can model entities with "facts" about them. For example: </p> <ul> <li>Payment code <code>XYZ</code> contains attribute <code>TradeCredit</code> (Net-30, Net-60, etc.)</li> <li>Attribute <code>TradeCredit</code> is of type <code>CalendarInterval</code></li> <li>Type <code>CalendarInterval</code> is displayed as a drop-down</li> <li>.. and so on</li> </ul> <hr> <p>Re your comments: Yeah, I am wary of any solution that uses XML. To paraphrase <a href="http://en.wikiquote.org/wiki/Jamie_Zawinski" rel="nofollow noreferrer">Jamie Zawinski</a>:</p> <blockquote> <p>Some people, when confronted with a problem, think "I know, I'll use XML." Now they have two problems.</p> </blockquote> <p>Another solution would be to invent a little <a href="http://en.wikipedia.org/wiki/Domain-specific_language" rel="nofollow noreferrer">Domain-Specific Language</a> to describe your forms. Use that to generate the user-interface. Then use the database <em>only</em> to store the values for form data instances.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload