[Zope-DB] Problems using multiple DB reads using a parameter

Matthew T. Kromer matt@zope.com
Wed, 26 Feb 2003 15:18:55 -0500

Maszerowski, Thomas wrote:

>I building a simple report that need an owner ID (integer) in order to use a
>WHERE on a SELECT statement. Since my reporting needs aren't complex, I let
>Zope build the report using a Z Search Interface. I have a separate form
>that gets the ownerID value. The head of the report looks like this:
><dtml-var standard_html_header>
><h2><dtml-var title_or_id> <dtml-var document_title></h2>
><dtml-in selectByOwnerID size=20 start=query_start>
>   <dtml-if sequence-start>
>      <dtml-if previous-sequence>
>        <a href="<dtml-var URL><dtml-var sequence-query
>                 >query_start=<dtml-var
>                 previous-sequence-start-number>">
>        (Previous <dtml-var previous-sequence-size> results)
>The selectByOwnerID looks like this (ownerID is an argument to the method):
>SELECT tblLookupPersonnel.txtName, tblActions.*
>FROM tblActions LEFT JOIN tblLookupPersonnel
>ON tblActions.lngActoneerID = tblLookupPersonnel.lngPersonnelID
>WHERE tblActions.lngActoneerID = <dtml-sqlvar ownerID type=int>
>So far so good. The report creates tables of 20 records and then you can
>choose to display subsequent pages. It works fine on the first page, but
>always gives a "missing input variable, ownerID" instead of the second page.
>Why does it work the first time and not the second?
I dont think the form batch generator constructed the code you need to 
pass the ownerID variable to the subsequent pages.  You can probably do 
that yourself by tweaking the form a little bit.