Proposal:
We have a way of configuring foreign keys into the configuration file.
Configuration File Example:
<table name="grandpa"> ...
</table>
<table name="pa"..>
...
<foreign-key foreignTable="pa" name="mypa">
<reference local="pa_id" foreign="id">
<foreign-key>
...
</table>
<table name="son"..>
...
<foreign-key foreignTable="pa" name="mypa2">
<reference local="pa_id" foreign="id">
<foreign-key>
...
</table>
More elaborate example with multiple columns and formatting included:
<table name="order"..>
<field name="order_id" ... idKey="true"/>
<field name="date" ... />
...
<field name="area_id" ... />
<field name="cust_id" .../>
...
<foreign-key foreignTable="customer"
name="customer_known_in_order"
visibleFields="first_name,last_name,phone"
format="%s %s (Phone %s)">
<reference local="area_id" foreign="area_id">
<reference local="cust_id" foreign="id">
</foreign-key>
...
</table>
On the GUI you can then have:
Read only form:
<db:dbform name="order" ...>
...
<db:body>
<db:dateLabel field="date"/>
<db:dataLabel fieldName="customer_known_in_order"/>
...
</db:body>
</db:dbform>
Editable Form using select tag:
<db:dbform name="order" ...>
...
<db:body>
<db:dateField field="date"/>
<db:select fieldName="customer_known_in_order"/>
...
</db:body>
</db:dbform>
Note: the select is improved and simplified. You don't need the
visibleFields or stored Attribute or another
nest of tags and you can support multiple column keys. Also, you could put
the name of another foreign-key from another table as the fieldName and it
would be intelligent enough to check the linkages. Sometimes, you want
parent fields in the child's form and you don't want a select to do it. This
would solve that problem. You can also reuse the foreign keys in many other
forms in a standard way.
What do you think?
John.
-------------------------------------------------------
This sf.net email is sponsored by: Influence the future
of Java(TM) technology. Join the Java Community
Process(SM) (JCP(SM)) program now.
http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en
_______________________________________________
DbForms Mailing List
http://www.wap-force.net/dbforms