[Zope] problems sorting with in-tag

Kent Polk kent@goathill.org
1 Jun 1999 13:49:51 GMT


On 31 May 1999 16:40:01 -0500, Larry Luther wrote:
>I too have spent two days trying to do exactly this.
>
>I tried:  <!--#in aTinyTable sort="<--#var sortby-->"-->
>
>I eventually found on the zope.org site under Advanced DTML the
>statement that the above is illegal and that you really don't
>need it.  They didn't offer any further explanation!
>
[...]
>Apparently the developers didn't notice this problem because
>they always create tables in an SQL database and rely on a
>SQL method to do the sorting and filtering.  Come to think
>of it I remember seeing a database that could use comma
>separated fields like TinyTable does.  Maybe that has a
>SQL interface.  The hunt goes on...

The next version of TinyTables will allow you to query for the
column names and use that to iterate over, which might be rather
'interesting' to implement with SQL methods. However, the ability
to query for column names quickly illuminates this static name
limitation in DTML. 

Actually, this issue of not being able to query for column names
and dynamically build tabular results with the query results in
SQL methods was one of the two primary reasons for the TinyTables
concept.

With my TinyTables-like filesystemed database application (which
has the new new TinyTables column name query also, along with the
new VSEval() query method), I found that in addition to the 'sort='
problem, the statistics method names operate with the same limitation
and can't be assigned dynamically.

I ended up writing Python methods which dynamically build the dtml
and then render it with HTML(). It's a little inconvenient, but it
works fine.

Actually, I dumped the 'sort=' and now call an 'orderby()' method
which sorts the entire table by the column order which I provide
dynamically.  I have another method which allows me to dynamically
arrange the order of the column names, which I then iterate over
in dtml to arrange the column order. I sent the stuff to Ty, but
I'm not sure how well it could be implemented in TinyTables as my
stuff is application-specific enough that I can cut some corners
and not have to be so general.  I expect Ty would need to consider
whether it is really important enough to implement in TinyTables
and then determine if there is a general way to implement it. I'm
also looking at a more general solution, but I can live with what
I have for now. :^)

Kent