Hi. I am constructing a search interface for a catalog. The objects I index have three relevant properties: title (textual title) id (the id, sortable) book_title (the name of the book where the chapter is included) I want to have atabular result like this: Book 1 Chapter 1.1 Chapter 2.1 Book 2 Chapter 1.1 Chapter 4.2 To acomplish this I currently do something like: <dtml-in Catalog sort=id> <tr> <td><dtml-if first-book_title><dtml-var book_title></dtml-if></td> <td><dtml-var title></td> </tr> </dtml-in> But, to have the list look nice, I'd need to specify two fields for sorting, book_title should be the primary field sorted by, and id should be the field all identical book_title entries should be sorted on. Is there a way to do this with dtml-in? CYa, Mario <mlang@delysid.org>
It sounds like this is probably coming from an SQL database? If it is modify the query you're using to sort on the DBML-side. If your query looked like: select * from books You would modify it. Having mutliple levels of order by varies from DBMS to DBMS, but it'll look something like this: select * from books order by book_name, id Or something to that effect. Sorting using the DBMS is more desirable as well because the DBMS is likely to sort it more quickly, with all its indicies and so forth. If you tell me which DBMS you're using, I probably know exactly what you should do to your query. Mario Lang wrote:
Hi.
I am constructing a search interface for a catalog. The objects I index have three relevant properties: title (textual title) id (the id, sortable) book_title (the name of the book where the chapter is included)
I want to have atabular result like this:
Book 1 Chapter 1.1 Chapter 2.1 Book 2 Chapter 1.1 Chapter 4.2
To acomplish this I currently do something like:
<dtml-in Catalog sort=id> <tr> <td><dtml-if first-book_title><dtml-var book_title></dtml-if></td> <td><dtml-var title></td> </tr> </dtml-in>
But, to have the list look nice, I'd need to specify two fields for sorting, book_title should be the primary field sorted by, and id should be the field all identical book_title entries should be sorted on.
Is there a way to do this with dtml-in?
CYa, Mario <mlang@delysid.org>
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- Ken Kinder 303.381.7631
Date: Wed, 22 Mar 2000 11:46:04 -0700 From: Ken Kinder <kkinder@MessageMedia.com> Organization: Messagemedia, Inc.
It sounds like this is probably coming from an SQL database? If it is modify the query you're using to sort on the DBML-side. If your query looked like: [...] No, its a dtml-in for a ZCatalog. Can I pre-sort the catalog for one MetaData field, and sort the dtml-in for the other one?
Or are their any easy ways to modify the dtml-in tag to handle multiple sort fields? CYa, Mario
participants (2)
-
Ken Kinder -
Mario Lang