ODBiC Discussion Board

RE: Sorting a report by 'clicking' on a header, Jongr, 10-19-2006

Order By in your select.

by Max Steiner, October 19, 2006 19:54

Sure.. How I would do this (and there are probably better ways) is make the column heading a link and just re-execute the same screen with a different SQL command with an "order by" clause in the sql.

example: /sample.tpl?sortby=productid or /sample.tpl?sortby=category

Then your code would look something like this:

<!--IF $sortby$=productid--> <!--SELECT * from xxx Order by product_id;--> <!--ELSE IF $sortby$=category--> <!--SELECT * from xxx Order by category_cd;--> <!--ENDIF--> <!--EACHROW--> <!--NOTE Format your screen here --> <!--ENDROW-->

** Like I said, there are probably better ways to do this.. but this is how I would approach it.


Post Your Reply:

E-mail  optional

HTTP Link: 
Link text: 


Copyright ©1997-2003, Roger Harris. All rights reserved.