473,385 Members | 2,180 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,385 software developers and data experts.

sorting output

I have a table of about 20 Categories. I currently have them displayed
accross the page in a table from left to right in 3 columns. like this:
abuse cmecf credit/etc
dismissal presumptions

You will notice the sort runs from left to right. I would like the sort to
run vertically like this:
abuse dismissal
cmecf presumptions
credit/etc

I am outputting from an access table into an html table via asp. Does
anyone have a trick to get the output the way I want it.
Could I populate an array and then output like this:

array(1) array(4) array(7)
array(2) array(5) array(8)

Any help is appreciated.

thanks
Milton
Jul 26 '05 #1
3 1302
"Milton Snider" wrote in message
news:OM**************@TK2MSFTNGP14.phx.gbl...
:I have a table of about 20 Categories. I currently have them displayed
: accross the page in a table from left to right in 3 columns. like this:
: abuse cmecf credit/etc
: dismissal presumptions
:
: You will notice the sort runs from left to right. I would like the sort
to
: run vertically like this:
: abuse dismissal
: cmecf presumptions
: credit/etc
:
: I am outputting from an access table into an html table via asp. Does
: anyone have a trick to get the output the way I want it.
: Could I populate an array and then output like this:
:
: array(1) array(4) array(7)
: array(2) array(5) array(8)

Assume rs is the recordset variable and arr is the 2-dimensional array
created using GetRows()

If you used GetRows, you can easily do this.

Const numColumns = 3
dim numRecords, arr, rowCounter, colCounter, displayName

' connect to database and return data

arr = rs.GetRows()

Response.Write "<table width=""100%"">"
numRecords = ubound(arr,2) + 1
if numRecords mod numColumns = 0 then
numRows = numRecords\numColumns
Else
numRows = numRecords\numColumns + 1
End if

For rowCounter = 1 to numRows
Response.Write "<tr>"
For colCounter = 0 to numColumns - 1
If rowCounter + colCounter * numRows <= numRecords then
displayName = arr(0, rowCounter + colCounter * numRows - 1)
Response.Write "<td style=""width: 33%"">" & arr(1, rowCounter +
colCounter * numRows - 1) & displayName & "</td>"
Else
Response.write "<td>&nbsp;</td>"
end if
Next
Response.Write "</tr>"
Next

I've done this with two columns. I've made some changes to work with 3 but
it's not tested.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 26 '05 #2
"Roland Hall" <nobody@nowhere> wrote in message
news:O5**************@TK2MSFTNGP12.phx.gbl...
"Milton Snider" wrote in message
news:OM**************@TK2MSFTNGP14.phx.gbl...
:I have a table of about 20 Categories. I currently have them displayed
: accross the page in a table from left to right in 3 columns. like this:
: abuse cmecf credit/etc
: dismissal presumptions
:
: You will notice the sort runs from left to right. I would like the sort
to
: run vertically like this:
: abuse dismissal
: cmecf presumptions
: credit/etc
:
: I am outputting from an access table into an html table via asp. Does
: anyone have a trick to get the output the way I want it.
: Could I populate an array and then output like this:
:
: array(1) array(4) array(7)
: array(2) array(5) array(8)

Assume rs is the recordset variable and arr is the 2-dimensional array
created using GetRows()

If you used GetRows, you can easily do this.

Const numColumns = 3
dim numRecords, arr, rowCounter, colCounter, displayName

' connect to database and return data

arr = rs.GetRows()

Response.Write "<table width=""100%"">"
numRecords = ubound(arr,2) + 1
if numRecords mod numColumns = 0 then
numRows = numRecords\numColumns
Else
numRows = numRecords\numColumns + 1
End if

For rowCounter = 1 to numRows
Response.Write "<tr>"
For colCounter = 0 to numColumns - 1
If rowCounter + colCounter * numRows <= numRecords then
displayName = arr(0, rowCounter + colCounter * numRows - 1)
Response.Write "<td style=""width: 33%"">" & arr(1, rowCounter +
colCounter * numRows - 1) & displayName & "</td>"
Else
Response.write "<td>&nbsp;</td>"
end if
Next
Response.Write "</tr>"
Next

I've done this with two columns. I've made some changes to work with 3
but
it's not tested.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation -
http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp

Jul 26 '05 #3
"Milton Snider" wrote in message
news:eg**************@tk2msftngp13.phx.gbl...
: "Roland Hall" wrote in message
: news:O5**************@TK2MSFTNGP12.phx.gbl...
: > "Milton Snider" wrote in message
: > news:OM**************@TK2MSFTNGP14.phx.gbl...
: > :I have a table of about 20 Categories. I currently have them displayed
: > : accross the page in a table from left to right in 3 columns. like
this:
: > : abuse cmecf credit/etc
: > : dismissal presumptions
: > :
: > : You will notice the sort runs from left to right. I would like the
sort
: > to
: > : run vertically like this:
: > : abuse dismissal
: > : cmecf presumptions
: > : credit/etc
: > :
: > : I am outputting from an access table into an html table via asp. Does
: > : anyone have a trick to get the output the way I want it.
: > : Could I populate an array and then output like this:
: > :
: > : array(1) array(4) array(7)
: > : array(2) array(5) array(8)
: >
: > Assume rs is the recordset variable and arr is the 2-dimensional array
: > created using GetRows()
: >
: > If you used GetRows, you can easily do this.
: >
: > Const numColumns = 3
: > dim numRecords, arr, rowCounter, colCounter, displayName
: >
: > ' connect to database and return data
: >
: > arr = rs.GetRows()
: >
: > Response.Write "<table width=""100%"">"
: > numRecords = ubound(arr,2) + 1
: > if numRecords mod numColumns = 0 then
: > numRows = numRecords\numColumns
: > Else
: > numRows = numRecords\numColumns + 1
: > End if
: >
: > For rowCounter = 1 to numRows
: > Response.Write "<tr>"
: > For colCounter = 0 to numColumns - 1
: > If rowCounter + colCounter * numRows <= numRecords then
: > displayName = arr(0, rowCounter + colCounter * numRows - 1)
: > Response.Write "<td style=""width: 33%"">" & arr(1, rowCounter +
: > colCounter * numRows - 1) & displayName & "</td>"
: > Else
: > Response.write "<td>&nbsp;</td>"
: > end if
: > Next
: > Response.Write "</tr>"
: > Next
: >
: > I've done this with two columns. I've made some changes to work with 3
: > but
: > it's not tested.

I got the idea a long time ago from a guy name Pete Draigh @
businessstrategy.com

Glad it worked for you.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 26 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: p0wer | last post by:
Let's suppose I have this sample document: <root> <entry id="1" <date>2003-08-03</date> <param_1>5</param_1> <param_2>10</param_2> </entry> <entry id="2"> ...
8
by: Mike MacSween | last post by:
tblCourses one to many to tblEvents. A course may have an intro workshop (a type of event), a mid course workshop, a final exam. Or any combination. Or something different in the future. At...
3
KevinADC
by: KevinADC | last post by:
If you are entirely unfamiliar with using Perl to sort data, read the "Sorting Data with Perl - Part One and Two" articles before reading this article. Beginning Perl coders may find this article...
2
by: Bob Laubla | last post by:
Hello I have a very complex maketable query with many records and involving multiple VB functions which call other functions. I need this table to be sorted by the first field. But no matter what...
1
by: LittlBUGer | last post by:
Hello. First of all I'm programming in VB.NET/ASP.NET doing a page for a website. Now, to my question.... I have a simple array of integer numbers (15 characters in length) which can hold up to...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.