[Zope-DB] Multi table update from one input form
Dieter Maurer
dieter@handshake.de
Sun, 22 Sep 2002 19:12:32 +0200
Norman Khine writes:
> ...
> select last_value from business_name_business_name_seq as fk_business_id
> <dtml-var sql_delimiter>
> INSERT INTO business_address (street_name, town, county, postcode,
> ...
> <dtml-var fk_business_id>);
>
> But this does not work, and I get the following error:
>
> KeyError: fk_business_id
As you found out, there is no magic connection between the results
of a previous SQL command and the DTML variables of a current one.
You need to use either SQL features or work with separate Z SQL Methods
with gluing code in DTML (or, better, Python Script).
You do not told us what database you used. Depending on the system,
you might access "fk_business_id" either with a nested "select" (will not
work with MySQL) or with an SQL function that directly accesses
the "last_value" of "business_name_business_name_seq", e.g.
"last_value(business_name_business_name_seq)".
Dieter