473,324 Members | 2,239 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

sort by column heading not working

Hello,

I have some code commented out in order to make this work. However, I would prefer to use the commented code so my users can SORT on the column heading because I know they are going to want to do that.

I appreciate any help that you can give me.

Thanks, Kris
-----------------------------------------------------
<html>
<body>

<a href="reports.html">Custom Reports</a>

<h1>Items: Non-Fiction</h1>

<script>
function choose(id){
// this selects the radio button that goes with the text link
document.getElementById(id).checked=true;
}
function enable(){
document.getElementById().disabled=false;
}
</script>

<%orgcodeid=request.form("orgcodeid")%>
<%collectionid=request.form("collectionid")%>
<%callnum=request.form("callnum")%>

<form method="post">
<fieldset>
<input type="radio" name="orgcodeid" value="19" checked="checked">None

<input type="radio" name="orgcodeid" value="3">3-Basin City
<input type="radio" name="orgcodeid" value="4">4-Benton City
<input type="radio" name="orgcodeid" value="5">5-Bookmobile
<input type="radio" name="orgcodeid" value="6">6-Connell
<input type="radio" name="orgcodeid" value="7">7-Kahlotus
<br>
<input type="radio" name="orgcodeid" value="8">8-Keewaydin
<input type="radio" name="orgcodeid" value="9">9-Kennewick
<input type="radio" name="orgcodeid" value="10">10-Merrill's
<input type="radio" name="orgcodeid" value="11">11-Othello
<input type="radio" name="orgcodeid" value="12">12-Pasco
<input type="radio" name="orgcodeid" value="13">13-Prosser
<input type="radio" name="orgcodeid" value="14">14-West Richland
</fieldset>
<p>
<fieldset>
<input type="radio" name="collectionid" value="5" id="anf">5-Adult Non-Fiction
<p>
<input type="radio" name="callnum" value="'0%'" onclick='choose("anf");enable()'>001-099
<input type="radio" name="callnum" value="'1%'" onclick='choose("anf");enable()'>100-199
<input type="radio" name="callnum" value="'2%'" onclick='choose("anf");enable()'>200-299
<input type="radio" name="callnum" value="'3%'" onclick='choose("anf");enable()'>300-399
<input type="radio" name="callnum" value="'4%'" onclick='choose("anf");enable()'>400-499
<input type="radio" name="callnum" value="'5%'" onclick='choose("anf");enable()'>500-599
<input type="radio" name="callnum" value="'6%'" onclick='choose("anf");enable()'>600-699
<input type="radio" name="callnum" value="'7%'" onclick='choose("anf");enable()'>700-799
</fieldset>
<p>
<fieldset>
<input type="radio" name="collectionid" value="19" id="cnf">19-Children's Non-Fiction
<p>
<input type="radio" name="callnum" value="'E 0%'" onclick='choose("cnf");enable()'>E 001-E 099
<input type="radio" name="callnum" value="'E 1%'" onclick='choose("cnf");enable()'>E 100-E 199
<input type="radio" name="callnum" value="'E 2%'" onclick='choose("cnf");enable()'>E 200-E 299
<input type="radio" name="callnum" value="'E 3%'" onclick='choose("cnf");enable()'>E 300-E 399
<input type="radio" name="callnum" value="'E 4%'" onclick='choose("cnf");enable()'>E 400-E 499
<input type="radio" name="callnum" value="'E 5%'" onclick='choose("cnf");enable()'>E 500-E 599
<input type="radio" name="callnum" value="'E 6%'" onclick='choose("cnf");enable()'>E 600-E 699
<input type="radio" name="callnum" value="'E 7%'" onclick='choose("cnf");enable()'>E 700-E 799
<p>
<input type="radio" name="callnum" value="'J 0%'" onclick='choose("cnf");enable()'>J 001-J 099
<input type="radio" name="callnum" value="'J 1%'" onclick='choose("cnf");enable()'>J 100-J 199
<input type="radio" name="callnum" value="'J 2%'" onclick='choose("cnf");enable()'>J 200-J 299
<input type="radio" name="callnum" value="'J 3%'" onclick='choose("cnf");enable()'>J 300-J 399
<input type="radio" name="callnum" value="'J 4%'" onclick='choose("cnf");enable()'>J 400-J 499
</fieldset>
<p>
<input type="submit" value="Show me the items">
<p>
</form>

<%
'if request.querystring("sort")<>"" then
' sort=request.querystring("sort")
'else
' sort="ird.callnumber"
'end if

set conn=Server.CreateObject("ADODB.Connection")
DSNtest="DRIVER={SQL Server}; SERVER="
conn.Open DSNtest

set rs=Server.CreateObject("ADODB.recordset")
sql=sql& "select cir.barcode as Barcode, ird.callnumber, "
sql=sql& "br.browsetitle as Title, br.publicationyear, "
sql=sql& "cast(datepart(m,ird.creationdate) as nvarchar(2))+'-'+ cast(datepart(dd,ird.creationdate)as nvarchar(2)) "
sql=sql& "+'-'+ cast(datepart(yyyy,ird.creationdate)as nvarchar(4)), "
sql=sql& "cir.LifetimeCircCount as LifeCirc, cast(datepart(m,cir.lastcirctransactiondate) as nvarchar(2))+'-'+ "
sql=sql& "cast(datepart(dd,cir.lastcirctransactiondate) as nvarchar(2))+'-'+ "
sql=sql& "cast(datepart(yyyy,cir.lastcirctransactiondat e)as nvarchar(4)), "
sql=sql& "ist.description, col.name "
sql=sql& "from circitemrecords cir "
sql=sql& "join itemstatuses ist on cir.itemstatusid=ist.itemstatusid "
sql=sql& "join itemrecorddetails ird on cir.itemrecordid=ird.itemrecordid "
sql=sql& "join bibliographicrecords br on cir.associatedbibrecordid=br.bibliographicrecordid "
sql=sql& "join organizations o on cir.assignedbranchid=o.organizationid "
sql=sql& "join collections col on cir.assignedcollectionid=col.collectionid "
sql=sql& "where o.organizationid= '" & orgcodeid & "' "
sql=sql& "and col.collectionid ='" & collectionid & "' "
sql=sql& "and ird.callnumber like " & callnum & " "
sql=sql& "and (ist.itemstatusid <> 7 "
sql=sql& "and ist.itemstatusid <> 10 "
sql=sql& "and ist.itemstatusid <> 11 "
sql=sql& "and ist.itemstatusid <> 13 "
sql=sql& "and ist.itemstatusid <> 14 "
sql=sql& "and ist.itemstatusid <> 15) "
'sql=sql& "group by cir.barcode, ird.callnumber, br.browsetitle, br.publicationyear, ird.creationdate, cir.LifetimeCircCount, cir.lastcirctransactiondate, ist.description, col.name "
'sql=sql& "order by " & sort
sql=sql& "order by ird.callnumber "

rs.Open sql,conn
str=rs.GetString(,,"</td><td>","</td></tr><tr><td>","&nbsp;")
%>

<table border="1" width="100%" bgcolor="#fff5ee">
<tr>
<th align="center" bgcolor="#b0c4de">
<%
Dim branch
whodat=Request("orgcodeid")
Response.Write "with OrganizationID . . . " & whodat
%>
</th>
</tr>
</table>


<table border="1" width="100%" bgcolor="#fff5ee">
<tr>
<th align="left" bgcolor="#b0c4de">Barcode</th>
<th align="left" bgcolor="#b0c4de">CallNumber</th>
<th align="left" bgcolor="#b0c4de">Title</th>
<th align="left" bgcolor="#b0c4de">PubYear</th>
<th align="left" bgcolor="#b0c4de">Created</th>
<th align="left" bgcolor="#b0c4de">Circs</th>
<th align="left" bgcolor="#b0c4de">LastCirc</th>
<th align="left" bgcolor="#b0c4de">In?</th>
<th align="left" bgcolor="#b0c4de">Collection</th>
</tr>
<tr>
<td><%Response.Write(str)%></td>
</tr>
</table>

<%
rs.close
conn.close
set rs = Nothing
set conn = Nothing
%>

</body>
</html>
Apr 30 '07 #1
0 1472

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Thomas Jerkins | last post by:
When I write a create table SQL statement I want to add some information about the column heading of each column. How does the exact syntax for the create table look like (which includes this column...
4
by: Bruce Pullum | last post by:
I have a datagrid that I am using a DataView with. All works great for the sorting of the columns. However, after I sort the column, and then try and select a data row to edit, the row selected...
4
by: pw | last post by:
Hi, I have month names (coming from a field in a table) as the column heading in an Access 97 crosstab query. It is being sorted alphabetically. This will not do. The only way that I know to...
3
by: Paula | last post by:
I need to do a summary using a crosstab query. The data has a Date field (Not named "Date"). I can do the Row Heading and Value but am having trouble with the Column Heading. The summary Columns...
4
by: skOOb33 | last post by:
I successfully autosized the columns and rows on my Datagrid, and am now facing another issue. Having the sorting ability by clicking the column headers is key, but when I do that, it resizes all...
0
by: Kaur | last post by:
Hi, I have created a report based on a cross tab query and would like to Sort the column heading of the report based on the sort order of another field. I have three tables called survey...
0
by: Kaur | last post by:
Hi, I have created a report based on a cross tab query and would like to Sort the column heading of the report based on the sort order of another field. I have three tables called survey...
1
by: keithb | last post by:
I have a working ASP.NET 2.0 application that uses a GridView control. How can I enable the feature that allows a user to click on a column heading and sort the contents by the information in that...
1
by: ECD | last post by:
Hello all, I can usually find solutions to my .NET problems by searching these groups, but I'm stumped on this one. I have a datagrid in VB.NET (2.0 framework). I want to disable sorting on...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.