[Zope] Help with Z Search Interface and ranges

Willie Peloquin wpeloqui@ismi.net
Thu, 18 Nov 1999 08:35:43 -0600


Hi,

Could someone point me to an example of a Z Search Interface that will allow
me to search for instances with less than or greater than type values: ie.

price between 10000 and 15000
price >= 10000 and price <= 15000

I really don't understand how these pages are working.
I have appended the search and report DTML that was generated in a small
sample database I created. How do the items in the form get transfered to
the 'report' dtml, via the URL? Does the report parse the URL to determine
the search parameters, or is there a hidden method that I don't know about.
Jeff sent me an example, but I don't quite understand it yet. Where would
this fit into my 'report' and 'search' dtmls. It seems I have more
'fundamentals' to learn.

Thank you all for your assistance,
Willie

>Take a look at:
>  http://www.zope.org/SiteIndex/newitems.html/view_source

>where zope.org uses a lower-range on the date field to show all items
>new within a recent interval of time.  The key is to append a '_usage'
>string to the name of the field you wish to bracket.

><!--#call "REQUEST.set('date_usage','range:min')"-->
><!--#call "REQUEST.set('date', ZopeTime().earliestTime()-1)"-->

>In your case, you'd use both a min and a max:

><!--#call "REQUEST.set('price_usage','range:min:max')"-->
><!--#call "REQUEST.set('price', [10000, 15000])"-->

>I can't remember whether the range is inclusive or not i.e.
>whether it represents >= or just >.

>-Jeff Rush

-------->
--------> example search dtml
-------->

<!--#var standard_html_header-->

<form action="report" method="get">
<h2><!--#var document_title--></h2>
Enter query parameters:<br><table>

<tr><th>Value</th>
    <td><input name="value"
               width=30 value=""></td></tr>
<tr><th>Beds</th>
    <td><input name="beds"
               width=30 value=""></td></tr>
<tr><td colspan=2 align=center>
<input type="SUBMIT" name="SUBMIT" value="Submit Query">
</td></tr>
</table>
</form>
<!--#var standard_html_footer-->

---------->
----------> example report DTML Method
---------->

<!--#var standard_html_header-->
<!--#in HouseCatalog size=50 start=query_start-->
   <!--#if sequence-start-->

      <!--#if previous-sequence-->

        <a href="<!--#var URL--><!--#var sequence-query
                 -->query_start=<!--#var
                 previous-sequence-start-number-->">
        (Previous <!--#var previous-sequence-size--> results)
        </a>

      <!--#/if previous-sequence-->

      <table border>
        <tr>
          <th>Id</th>
          <th>Beds</th>
          <th>Value</th>
          <th>Bobobase modification time</th>
          <th>Title</th>
          <th>Meta type</th>
        </tr>

   <!--#/if sequence-start-->

        <tr>
          <td><!--#var id--></td>
          <td><!--#var beds--></td>
          <td><!--#var value--></td>
          <td><!--#var bobobase_modification_time--></td>
          <td><!--#var title--></td>
          <td><!--#var meta_type--></td>
        </tr>

   <!--#if sequence-end-->

      </table>
      <!--#if next-sequence-->

         <a href="<!--#var URL--><!--#var sequence-query
            -->query_start=<!--#var
            next-sequence-start-number-->">
         (Next <!--#var next-sequence-size--> results)
         </a>

      <!--#/if next-sequence-->
   <!--#/if sequence-end-->

<!--#else-->

  There was no data matching this <!--#var title_or_id--> query.

<!--#/in-->

<!--#var standard_html_footer-->


Thanks in advance,
Willie

Willie Peloquin
Senior Software Engineer - Contract
http://www.ismi.net/~wpeloqui

"It is unwise to stray from the obvious and simple."