[Zope] ASC / DESC in queries`?

Jim Washington jwashin@vt.edu
Tue, 26 Feb 2002 08:19:34 -0500


Jan Johansson wrote:

>>Just do not pass any part of the actual SQL you will use in 
>>REQUEST, and 
>>you should be fine.
>>Probably easiest in this case would be to pass a flag that means 
>>ascending, then use some dtml in your ZSQL Method like this, or 
>>something similar:
>>
>><dtml-if sort_order_asc>ASC<dtml-else>DESC</dtml-if>
>>
>
>Aaaah, never thought about that, simple solution too. Uhm, now comes a real newbie question tho. How do i "unset" a variable?  I must be blind in my Zope Book and assorted online resources. What i am trying to do is a simple "sort ASC/DESC" toggle on a sql-result page.
>
Please keep your questions on the list to help others.

I would set it to a zero-length string. Zope handles the following OK on 
my machine.

<a href="<dtml-var URL0>?sort_order_asc=1">ascending</a>
<a href="<dtml-var URL0>?sort_order_asc=">descending</a>

-- Jim Washington