Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > sorting output

Reply
Thread Tools

sorting output

 
 
Milton Snider
Guest
Posts: n/a
 
      07-26-2005
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(

Any help is appreciated.

thanks
Milton


 
Reply With Quote
 
 
 
 
Roland Hall
Guest
Posts: n/a
 
      07-26-2005
"Milton Snider" wrote in message
news:(E-Mail Removed)...
: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(

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


 
Reply With Quote
 
 
 
 
Milton Snider
Guest
Posts: n/a
 
      07-26-2005
"Roland Hall" <nobody@nowhere> wrote in message
news:(E-Mail Removed)...
> "Milton Snider" wrote in message
> news:(E-Mail Removed)...
> :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(
>
> 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
>
>



 
Reply With Quote
 
Roland Hall
Guest
Posts: n/a
 
      07-26-2005
"Milton Snider" wrote in message
news:(E-Mail Removed)...
: "Roland Hall" wrote in message
: news:(E-Mail Removed)...
: > "Milton Snider" wrote in message
: > news:(E-Mail Removed)...
: > :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(
: >
: > 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting list vs sorting vector boltar2003@boltar.world C++ 2 07-06-2010 09:40 AM
fired event Sorting which wasn't handled - sorting and SelectedIndexChanged Jason ASP .Net Web Controls 0 10-04-2006 02:19 PM
Sorting output m_schellens@hotmail.com C++ 4 03-08-2006 05:43 AM
Ordered output without "sorting" array Simon Morgan C Programming 2 07-26-2005 08:33 PM
sorting by multiple criterias (sub-sorting) Tom Kirchner Perl Misc 3 10-11-2003 05:16 PM



Advertisments