I have a simple <DTML-Method> that displays multiple records as the result of a query. One of the fields displayed is to be updated. What I would like to know is how to get the form to work so that several records can have that one field updated at the same time. I can get it to work easily to update one record at a time, but would like to allow up to 25 records to be updated at once - is this possible? This is the update query: update cmin_meeting set committee_code=<dtml-sqlvar committee_code type=int> where meeting_ref=<dtml-sqlvar meeting_ref type=int> But this code only works for one individual record on its own, not multiple records. Thanks, ------------------------------------------------- Craig Stoddart IT Software Development Officer Dundee City Council IT Division Northern College Technical Block Gardyne Road Dundee DD5 1NY Phone: 01382 438170 Fax: 01382 438002 E-mail: craig.stoddart@dundeecity.gov.uk -------------------------------------------------
This is really an SQL syntax question. You probably want where meeting_ref in (val1,val2,...) You want to get Zope to create a comma-separated list for you, and insert it into the update statement. Tom P Craig Stoddart asked - I have a simple <DTML-Method> that displays multiple records as the result of a query. One of the fields displayed is to be updated. What I would like to know is how to get the form to work so that several records can have that one field updated at the same time. I can get it to work easily to update one record at a time, but would like to allow up to 25 records to be updated at once - is this possible? This is the update query: update cmin_meeting set committee_code=<dtml-sqlvar committee_code type=int> where meeting_ref=<dtml-sqlvar meeting_ref type=int> But this code only works for one individual record on its own, not multiple records.
Do something like..... <dtml-in display_records_sql size=50 start=query_start> <dtml-call "update_sql(comittee_code=comittee_code,meeting_ref=meeting_ref)"> ..... ..... Mohan. -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Craig Stoddart Sent: Thursday, April 26, 2001 11:29 AM To: zope@zope.org Subject: [Zope] Multiple SQL Updates I have a simple <DTML-Method> that displays multiple records as the result of a query. One of the fields displayed is to be updated. What I would like to know is how to get the form to work so that several records can have that one field updated at the same time. I can get it to work easily to update one record at a time, but would like to allow up to 25 records to be updated at once - is this possible? This is the update query: update cmin_meeting set committee_code=<dtml-sqlvar committee_code type=int> where meeting_ref=<dtml-sqlvar meeting_ref type=int> But this code only works for one individual record on its own, not multiple records. Thanks, ------------------------------------------------- Craig Stoddart IT Software Development Officer Dundee City Council IT Division Northern College Technical Block Gardyne Road Dundee DD5 1NY Phone: 01382 438170 Fax: 01382 438002 E-mail: craig.stoddart@dundeecity.gov.uk ------------------------------------------------- _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Hi Craig You can pass a list of things to a sql method and if you use a <dtml-sqltest ...> statement correctly the sql method will handle it nicely. What you need to do is change your update query by changing the <dtml-sqlvar> to a <dtml-sqltest> and adding the 'multiple' attribute: update cmin_meeting set committee_code=<dtml-sqlvar committee_code type=int> where <dtml-sqltest meeting_ref column=meeting_ref type=int multiple> I'll admit I haven't used this technique for updates but works fine for selects so I'm confident it will work for updates too. Hope this helps, Tom Craig Stoddart wrote:
I have a simple <DTML-Method> that displays multiple records as the result of a query. One of the fields displayed is to be updated. What I would like to know is how to get the form to work so that several records can have that one field updated at the same time. I can get it to work easily to update one record at a time, but would like to allow up to 25 records to be updated at once - is this possible?
This is the update query:
update cmin_meeting set committee_code=<dtml-sqlvar committee_code type=int> where meeting_ref=<dtml-sqlvar meeting_ref type=int>
But this code only works for one individual record on its own, not multiple records.
Thanks, ------------------------------------------------- Craig Stoddart IT Software Development Officer
-- Tom Jenkins devIS - Development Infostructure http://www.devis.com
participants (4)
-
Craig Stoddart -
Mohan Baro -
Thomas B. Passin -
Tom Jenkins