Forums

This topic is locked

Sorting a filtered results page

Posted 22 Apr 2001 17:46:45
1
has voted
22 Apr 2001 17:46:45 James Hutt posted:
I've designed a phone book application for my company intranet using UltraDev and an Access back end database. It works fine and has gone down a storm with those that use it on a regular basis. Users can select people and their associated phone number(s) by department, office location, part or all of their first and/or last name. However, sorting the results, especially when they have been filtered, is turning out to be quite a stretch for me. I need some help. I have been able to set-up a results table so that it sorts the results. However, when I try and sort the filtered results by clicking on the sort arrow image I have set up, the entire set of records is sorted an displayed instead of the filtered recordset. Strange, but try. Anyone got any tips or pointers that might set me in the right direction? As a note: I got the necessary information to sort my records from the tutorial section of the following web site: www.ultradeviant.co.uk/

Replies

Replied 22 Apr 2001 22:33:38
22 Apr 2001 22:33:38 Carolus Holman replied:
I basically use a Drop down "Order by" Menu, you could easily use detail links.
I send the link back to the same page, and request the form object:
Request.QueryString("order_by" I then replace the Order By variable with the field from the form....my working example is on a Corporate Intranet, so sorry I can't post it here... Here is a sample piece of Code...


<pre id=code><font face=courier size=2 id=code>&lt;% Request.QueryString("orderby" %&gt;
&lt;%
Dim qryClass_Detail_Alpha__Schedule_Order
qryClass_Detail_Alpha__Schedule_Order = "Class_Start_Date ASC"
if (Request.QueryString("order_by" &lt;&gt; "" then qryClass_Detail_Alpha__Schedule_Order = Request.QueryString("order_by"
%&gt;
&lt;%
Dim qryClass_Detail_Alpha__Show_Trimester
qryClass_Detail_Alpha__Show_Trimester = "2"
if (Request.QueryString("Trimester" &lt;&gt; "" then qryClass_Detail_Alpha__Show_Trimester = Request.QueryString("Trimester"
%&gt;
&lt;%
set qryClass_Detail_Alpha = Server.CreateObject("ADODB.Recordset"
qryClass_Detail_Alpha.ActiveConnection = MM_Training_Conn_STRING
qryClass_Detail_Alpha.Source = "SELECT * FROM qry_Class_Detail_Alpha WHERE Trimester = " + Replace(qryClass_Detail_Alpha__Show_Trimester, "'", "''" + " ORDER BY " + Replace(qryClass_Detail_Alpha__Schedule_Order, "'", "''" + ""
qryClass_Detail_Alpha.CursorType = 0
qryClass_Detail_Alpha.CursorLocation = 2
qryClass_Detail_Alpha.LockType = 3
qryClass_Detail_Alpha.Open()
qryClass_Detail_Alpha_numRows = 0
%&gt;
&lt;form name="OrderSelection" action="class_schedule.asp" method="get"&gt;
&lt;select name="order_by"&gt;
&lt;option value="Class_Start_Date ASC" selected&gt;Sort by&lt;/option&gt;
&lt;option value="Class_Start_Date ASC"&gt;Date&lt;/option&gt;
&lt;option value="ClassName ASC"&gt;Class Name&lt;/option&gt;
&lt;option value="Training_Location ASC"&gt;Location&lt;/option&gt;
&lt;/select&gt;
&lt;select name="Trimester"&gt;
&lt;option value="1" selected&gt;Choose Trimester&lt;/option&gt;
&lt;option value="1"&gt;First Trimester&lt;/option&gt;
&lt;option value="2"&gt;Second Trimester&lt;/option&gt;
&lt;option value="3"&gt;Third Trimester&lt;/option&gt;
&lt;/select&gt;
&lt;input type="submit" name="Submit" value="Go"&gt;
&lt;/form&gt;</font id=code></pre id=code>

The Los is a ghost

Reply to this topic