Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting Data

Status
Not open for further replies.

GDX

Programmer
Jun 4, 2000
186
US
Hello Guys,

I am pulling states from a table and displaying them 3 per row for example:

Alabama | Alaska | Arizona
Arkansas | California | Colorado

I am using the following code tobreak into another row:

XState = XState + 1
If XState = "3" Then
XState = "0"
%>
<tr><tr>
<%End If%>

But my question is how can i get the data to display in the following manner:

Alabama | Arkansas
Alaska | California
Arizona | Colorado
|
|
\/


Any help would be greatly appreciated.



Gordon R. Durgha
gd@vslink.net
 
Im a little confused.

Alabama | Arkansas
Alaska | California
Arizona | Colorado
|
|
\/


That format which you indicated wouldnt really exist if youre pulling all 50 states - are you?

What i mean is...

Alabama | *This would not be Arkanas*
Alaska | California*
Arizona | Colorado*
|
|
\/

The right column is not accurate because you would be much further along in the alphabet. Assuming you are doing all 50 states..I would loop through the records in 1, one column table incrementnig a counter. When the coutner gets to 25, start a new table and use css to position it to the right of the first table.
 
Or if you pull them into an array (via GetRows if they're coming from a recordset), you figure out the number of rows
Code:
Round(UBound(aryRS, 2) / 3)
and the number of excess items in the last row
Code:
UBound(aryRS, 2) Mod 3
And then run through the rows, outputting elements thar are the (current row + excess), (current row + row count + excess), and (current row + row count + row count + excess), going across. Use an If to fill empty cells with [ignore]&nbsp;[/ignore] if desired.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top