[Zope] batch update

Mike Doanh Tran mtran at shufflemasterrd.com
Tue Sep 30 13:48:04 EDT 2003


Hi,

I am trying to use DTML to allow batch update of multiple records to a mysql 
database.  For simplicity i created five lists from a html form: one is the 
primary key id(pk_id), field1,field2,field3,field4.  Here is what i want to 
do.  I have an zSQL update method that looks like this:

UPDATE test_database set
field1=<dtml-sqlvar field1 type=string>,
field2=<dtml-sqlvar field2 type=string> ,
field3=<dtml-sqlvar field3 type=string>,
field4=<dtml-sqlvar field4 type=string> 
WHERE pk_id=<dtml-sqlvar pk_id type=nb>

I want to interate over the above method to update multiple records.  
Basically i have five lists of data: pk_id,field1,field2,field3,field4
i am having a hard time trying to split these lists up using DTML
so that the first item on each list correspond to the first item of the pk_id 
list, the second correspond to the second pk_id, and so on.

Can anyone give me some hints on how to this?

Thanks,

Mike  



 
HTML Form:

PK_ID  Field1 Field2 Field3 Field4
1            f1       f2      f3           f4
2           f1.1     f2.1   f3.1        f4.1

<form action="updateData" method="post">
<dtml-in getData>
  <input type="text" name="pk_id:list" value="<dtml-var pk_id>">
  <input type="text" name="field1:list" value="">
  <input type="text" name="field2:list" value="">
</dtml-in>
</form>



          



More information about the Zope mailing list