[Zope] Combing 2 list

Chan YH cyhoong@pc.jaring.my
Tue Aug 5 06:38:46 EDT 2003


I would like to combine 2 sql tables into one using dtml/python script
method.
Person (table) + Company (table) => Contact (table)

Can someone give a me a tip?

Thank a lot.

Data Entry Form
============
<dtml-var standard_html_header>
<h2><dtml-var title_or_id></h2>
<form method="post" action="form1_action" enctype="multipart/data">
<table>
   <dtml-in listPerson_sql>
      <tr>
         <td>Name:</td><td><dtml-var first_name>&nbsp;<dtml-var
last_name></td>
         <td><select name="co_name" value="">
                   <dtml-in listCompany_sql>
                      <option value="&dtml-co_name;">&dtml-co_name;</option>
                   </dtml-in listCompany>
             </select>
          </td>
      </tr>
   </dtml-in listPerson>
   <tr>
      <td><input type="submit" value="Submit" name="submit" /></td>
   </tr>
</table>
</form>
<dtml-var standard_html_footer>

Form1_action method - this method doesn't do anything
===============
???
<table>
<dtml-in listPerson_sql>
<dtml-in "REQUEST.co_name">
      <tr><td> sequence-item is: </td><td><dtml-var sequence-item></td></tr>
      <tr><td> name is: </td><td><dtml-var first_name><dtml-var
last_name></td></tr>
      <tr><td><br /></td></tr>
</dtml-in REQUEST.co_name>
</dtml-in listPerson>
</table>

SQL method
=========
listCompany_sql:
  select * from company

listPerson_sql
select * from person


Table schema
--------------
CREATE TABLE person
(
first_name        char(20),
last_name         char(20)
);

CREATE TABLE company
(
co_name         char(20),
co_phone        char(20)
);

CREATE TABLE contact
(
first_name        char(20),
last_name         char(20),
co_name           char(20),
co_phone          char(20)
);





More information about the Zope mailing list