Getting a correctly formatted table from a GetRows array

Getting a correctly formatted table from a GetRows array

am 29.11.2005 22:05:23 von Laphan

Hi All

Somebody kindly sent me a routine to do this sometime ago, but for the life
of me I can't work out how it works and would prefer to use a simpler method
so that I can resolve any future issues with it.

Basically I have an array populated from a recordset getrows and I want to
create a nicely formatted table of this data with all of the right columns.

If my array consists of 8 rows of data and I want my table to display this
array 3 columns wide then the routine needs to make sure that it drops the
array rows onto enough table rows to show them all, eg:

< data1 > < data1 > < data1 >
< data1 > < data1 > < data1 >
< data1 > < data1 > < create the bit but obviously leave it
blank >

Any help you can give would be very much appreciated.

The code I currently use, but don't understand is as follows:

Response.Write "

BORDER=0>"

intArrayCount = UBound(arrSQLData,2)
intStartRow = 1

IF intArrayCount mod 3 = 0 THEN
intColDiff = CInt(intArrayCount \ 3)
ELSE
intColDiff = CInt(intArrayCount \ 3) + 1
END IF

FOR x = 1 TO intColDiff
Response.Write ""
intTargetRow = intStartRow
z=0

FOR y = 0 to intArrayCount
IF y = intTargetRow-1 THEN
Response.Write ""
intTargetRow = intTargetRow + intColDiff
END IF
NEXT

Response.Write ""
intStartRow = intStartRow + 1
NEXT

Response.Write "
BORDER=0>
"
Response.Write arrSQLData(1,y) & "
HEIGHT=10>

"

Re: Getting a correctly formatted table from a GetRows array

am 29.11.2005 23:26:15 von exjxw.hannivoort

Laphan wrote on 29 nov 2005 in microsoft.public.inetserver.asp.db:

> Hi All
>
> Somebody kindly sent me a routine to do this sometime ago, but for the
> life of me I can't work out how it works and would prefer to use a
> simpler method so that I can resolve any future issues with it.
>
> Basically I have an array populated from a recordset getrows and I
> want to create a nicely formatted table of this data with all of the
> right columns.
>
> If my array consists of 8 rows of data and I want my table to display
> this array 3 columns wide then the routine needs to make sure that it
> drops the array rows onto enough table rows to show them all, eg:
>
> < data1 > < data1 > < data1 >
> < data1 > < data1 > < data1 >
> < data1 > < data1 > < create the bit but obviously leave
> it
>blank >
>
> Any help you can give would be very much appreciated.
>
> The code I currently use, but don't understand is as follows:
>
> Response.Write "

> CLASS='ProdFullDesc' BORDER=0>"
>
> intArrayCount = UBound(arrSQLData,2)
> intStartRow = 1
>
> IF intArrayCount mod 3 = 0 THEN
> intColDiff = CInt(intArrayCount \ 3)
> ELSE
> intColDiff = CInt(intArrayCount \ 3) + 1
> END IF
>
> FOR x = 1 TO intColDiff
> Response.Write ""
> intTargetRow = intStartRow
> z=0
>
> FOR y = 0 to intArrayCount
> IF y = intTargetRow-1 THEN
> Response.Write ""
> intTargetRow = intTargetRow + intColDiff
> END IF
> NEXT
>
> Response.Write ""
> intStartRow = intStartRow + 1
> NEXT
>
> Response.Write "
> BORDER=0>
"
> Response.Write arrSQLData(1,y) & "
> HEIGHT=10>

"

The use of different counters confuses the issue,
I use one counter and calculate from there.
Not using response.write clears things up for me(!!).

Try this :


<%
count = UBound(theArray,2)
maxRows = int((count+1)/3+0.9)
%>



<%
for rows = 0 to maxRows-1
%>



<%
for cols = 0 to 2
y = rows + cols*maxRows
if y < count+1 then
%>



<%
else
%>



<%
end if
next
%>



<%
next
%>





<%=theArray(1,y)%>
 






--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Re: Getting a correctly formatted table from a GetRows array

am 29.11.2005 23:27:22 von exjxw.hannivoort

Evertjan. wrote on 29 nov 2005 in microsoft.public.inetserver.asp.db:

> I use one counter and calculate from there.

Sorry, two counters, rows and cols

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Re: Getting a correctly formatted table from a GetRows array

am 30.11.2005 10:37:59 von Oliver Weichhold

Many thanks Evertjan


"Evertjan." wrote in message
news:Xns971DEE9CF1B3Ceejj99@194.109.133.242...
Evertjan. wrote on 29 nov 2005 in microsoft.public.inetserver.asp.db:

> I use one counter and calculate from there.

Sorry, two counters, rows and cols

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)