[Zope-DB] MASTER/DETAIL - inserting a variable number of rows
Richard Rosenberg
richrosenberg at earthlink.net
Thu Aug 26 20:47:28 EDT 2004
Okay. . .so far I have made a little (very little) progress in at least
getting the zsql method to iterate over multiple inserts:
<params>
fld1:list
fld2:list
</params>
<dtml-in fld1>
INSERT INTO test1 (fld1, fld2) VALUES
(
<dtml-sqlvar sequence-item type="string">
,
<dtml-sqlvar sequence-index type="int">
)
<dtml-unless sequence-end>
<dtml-var sql_delimiter>
</dtml-unless>
</dtml-in>
This will iterate through each item in the list and generate the an
insert statement with proper delimiters between each statement. My
problem is that I do not want to insert 'sequence-index' as the new
value of fld2. I want to insert the value of the list 'fld2' (a list of
inegers) at the list index of 'fld1' in the current iteration.
Apparently Zope does not like to see <dtml-in fld1, fld2> which would
be legal in a Python For loop.
I've also tried nesting lists (passing one nested list as the argument)
and nesting <dtml-in> tags to no avail. Any ideas? Please help as I
feel I am close, and it is getting very frustrating.
More information about the Zope-DB
mailing list