[Zope-DB] Multi table update from one input form
Tue, 24 Sep 2002 09:31:21 +0100
I know, too long winded -- anyhow I found from the psql list that, as you
suggested previously to use a subselect sql statement, so here what the
final statement looks:
arguments: street_name town county postcode county_id
INSERT INTO business_address (street_name, town, county, postcode,
county_id, business_name_id) values (<dtml-sqlvar street_name
type="string">, <dtml-sqlvar town type="string">, <dtml-sqlvar county
type="string">, <dtml-sqlvar postcode
type="string">, <dtml-sqlvar county_id type="int">,
thanks for all your help
----- Original Message -----
From: "Dieter Maurer" <firstname.lastname@example.org>
To: "Norman Khine" <email@example.com>
Sent: Monday, September 23, 2002 6:10 PM
Subject: Re: [Zope-DB] Multi table update from one input form
> Norman Khine writes:
> > I am using PostgreSQL for the database.
> > Not sure if I understand your solution, as this is what I thought was
> > i.e. calling sequence_id_business_name as the DTML which calls the last
> > value added to this sequence_table, BUT I get an error, as the output
> > this method is "Shared.DC.ZRDB.Results.Results instance at 141d744",
> > guess is what is causing the error as it is trying to put this into the
> > fk_business_name field; as this is the default way for Python to
> > representation of an object, so to return the last value, I did this:
> > <dtml-in sequence_id_business_name>
> > <dtml-in sequence-item >
> > <dtml-var sequence-item>
> > </dtml-in-->
> > </dtml-in>
> Wow! A bit indirect:
> The result of a Z SQL Method call behaves like a sequence of rows.
> The colums in the row can be either accessed by their name or by
> their index.
> <dtml-var expr="sequence_id_business_name()">
> does the same, you do with your nested "dtml-in"
> (when you know that you get a single row with a single column).