[Zope] Passing arguments to secondary SQL query
Oliver Bleutgen
Oliver Bleutgen <myzope@gmx.net>
Tue, 29 May 2001 13:46:20 +0200
> Greetings,
> I am generating a report based on a SQL query, say query1. Using dtml-in
> it
> iterates over each returned row. Within each row, I would like to create
> a
> table based on a second query, say query2. Everything works great until I
> insert query2 in a second dtml-in statement. I can't figure out how to
> pass
> query2 arguments, which are dtml-vars from the current loop of query1. I
> get the error: Bad Request, Error Value: ['var1']. Here's a simplified
> example:
> query1: select var1 from mytab;
> query2: select newvar from mytab2 where myvar = <dtml-sqlvar var1
> type="string">;
> Report:
> <dtml-in query1>
> <dtml-var var1><br>
> <dtml-in query2> <!-- Here's where I'm stuck -->
> <dtml-var newvar><br>
> </dtml-in>
> </dtml-in>
try
<dtml-in "query2(var1=var1)">
i.e., you have to explicitly pass the arguments.
cheers,
oliver