[Zope] What's the magic word?

Brian Lloyd Brian@digicool.com
Wed, 6 Oct 1999 11:14:29 -0400


> I'm doing a search with an SQL query, which returns a bunch of hits.
> Now, what's the magic word in the _ namespace for finding how 
> many hits
> are in that query (the in tag), for example, "Your query on 
> blah had 4323
> hits on the word "bleh"" ? Is there maybe a way to do this via SQL?
> 
> -Thanks in advance

Try this. This snippet of dtml calls the query GetResults (you may
need to modify this if your query expects arguments, etc.). It uses
the let tag to create a temporary 'results' variable containing the
result of the query. Then it uses _.len to figure out how many result
records were returned.

<dtml let results="GetResults()">
  There are <dtml-var "_.len(results)"> results.
  <p>
  <dtml-in results>
  ... format result item here ...
  </dtml-in>
</dtml-let>


Brian Lloyd        brian@digicool.com
Software Engineer  540.371.6909              
Digital Creations  http://www.digicool.com