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><% Request.QueryString("orderby" %>
<%
Dim qryClass_Detail_Alpha__Schedule_Order
qryClass_Detail_Alpha__Schedule_Order = "Class_Start_Date ASC"
if (Request.QueryString("order_by" <> "" then qryClass_Detail_Alpha__Schedule_Order = Request.QueryString("order_by"
%>
<%
Dim qryClass_Detail_Alpha__Show_Trimester
qryClass_Detail_Alpha__Show_Trimester = "2"
if (Request.QueryString("Trimester" <> "" then qryClass_Detail_Alpha__Show_Trimester = Request.QueryString("Trimester"
%>
<%
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
%>
<form name="OrderSelection" action="class_schedule.asp" method="get">
<select name="order_by">
<option value="Class_Start_Date ASC" selected>Sort by</option>
<option value="Class_Start_Date ASC">Date</option>
<option value="ClassName ASC">Class Name</option>
<option value="Training_Location ASC">Location</option>
</select>
<select name="Trimester">
<option value="1" selected>Choose Trimester</option>
<option value="1">First Trimester</option>
<option value="2">Second Trimester</option>
<option value="3">Third Trimester</option>
</select>
<input type="submit" name="Submit" value="Go">
</form></font id=code></pre id=code>
The Los is a ghost
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><% Request.QueryString("orderby" %>
<%
Dim qryClass_Detail_Alpha__Schedule_Order
qryClass_Detail_Alpha__Schedule_Order = "Class_Start_Date ASC"
if (Request.QueryString("order_by" <> "" then qryClass_Detail_Alpha__Schedule_Order = Request.QueryString("order_by"
%>
<%
Dim qryClass_Detail_Alpha__Show_Trimester
qryClass_Detail_Alpha__Show_Trimester = "2"
if (Request.QueryString("Trimester" <> "" then qryClass_Detail_Alpha__Show_Trimester = Request.QueryString("Trimester"
%>
<%
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
%>
<form name="OrderSelection" action="class_schedule.asp" method="get">
<select name="order_by">
<option value="Class_Start_Date ASC" selected>Sort by</option>
<option value="Class_Start_Date ASC">Date</option>
<option value="ClassName ASC">Class Name</option>
<option value="Training_Location ASC">Location</option>
</select>
<select name="Trimester">
<option value="1" selected>Choose Trimester</option>
<option value="1">First Trimester</option>
<option value="2">Second Trimester</option>
<option value="3">Third Trimester</option>
</select>
<input type="submit" name="Submit" value="Go">
</form></font id=code></pre id=code>
The Los is a ghost