[Zope] Redirecting a browser if len(someSQLQueryResult) == 1

Timothy Wilson wilson@visi.com
Fri, 9 Nov 2001 07:44:18 -0600 (CST)


Hi everyone,

I'm building a SQL-based app for my site that makes it posssible to enter a
street address and city into a form and search for which elementary, middle,
and high school children at that address would attend.

I've got all the SQL stuff working well. Now I'm working on trying to
improve the interface. Here's what I want to do:

If someone performs a query using a street address like '123 Maple', the
query returns a list of matching items that might include '123 Maple Ave',
'123 Maple St', etc. This is what it's supposed to do. The user then sees a
list of potential matches with each item a hyperlink to the specific school
information for that address. For example:

/info/dwelling_info/dwellingID/971335/attendanceAreaRpt

calls the attendanceAreaRpt on the results of a 'dwelling_info' ZSQL method
using dwellingID = 971335. No problem there.

If the original search only returns one result, I'd like the browser to go
directly to the info for that address without having to take the additional
step of clicking on the address in the search report.

I can do <dtml-call
"RESPONSE.redirect('/info/dwelling_info/dwellingID/971335/attendanceAreaRpt')">,
but the obvious problem is that I've hardcoded the dwellingID. How can I
dynamically insert a portion of my SQL query (the dwellingID) into my
redirect?

-Tim

--
Tim Wilson      |   Visit Sibley online:   | Check out:
Henry Sibley HS |  http://www.isd197.org   | http://www.zope.com
W. St. Paul, MN |                          | http://slashdot.org
wilson@visi.com |  <dtml-var pithy_quote>  | http://linux.com