[Zope-DB] Multi table update from one input form
Dieter Maurer
dieter@handshake.de
Mon, 23 Sep 2002 19:10:11 +0200
Norman Khine writes:
> I am using PostgreSQL for the database.
> Not sure if I understand your solution, as this is what I thought was doing,
> 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 of
> this method is "Shared.DC.ZRDB.Results.Results instance at 141d744", which I
> 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 provide the
> 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.
Thus,
<dtml-var expr="sequence_id_business_name()[0][0]">
does the same, you do with your nested "dtml-in"
(when you know that you get a single row with a single column).
Dieter