Tables issue
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > IIS server support > IIS ASP > Tables issue




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Tables issue  
John Peach


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-11-07 12:17 PM

Not sure if this is the right place to post this, but sure someone will
kindly advise if it isn't

I have data from a SQL recordset that i want to display in a different
format, current code :

counter=0
for d= 1 to -int((-(ubound(bdata,2) +1))/3)
response.write "<tr>"
for e= 1 to 3

for c=1 to 2
response.write "<td class='a'>"
if counter >=  ubound(bdata,2) then
response.write "&nbsp;"
else
response.write bdata(c,counter)
end if
response.write "</td>"
next 'c
counter =counter +1
next 'e
response.write "</TR>"
next 'd

'next 'b


This write the array like

1    2    3

4    5    6

7    8



But i want to write the data like

1        4        7

2        5        8

3        6



Can anyone advise how to change the code to do this ?



Regards, with mental block

John







[ Post a follow-up to this message ]



    Re: Tables issue  
northof40


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-11-07 12:17 PM

On May 11, 11:19 pm, "John Peach" <john.pe...@zen.co.uk> wrote:
> Not sure if this is the right place to post this, but sure someone will
> kindly advise if it isn't
>
> I have data from a SQL recordset that i want to display in a different
> format, current code :
>
> counter=0
>  for d= 1 to -int((-(ubound(bdata,2) +1))/3)
>   response.write "<tr>"
>   for e= 1 to 3
>
>    for c=1 to 2
>     response.write "<td class='a'>"
>     if counter >=  ubound(bdata,2) then
>      response.write "&nbsp;"
>     else
>      response.write bdata(c,counter)
>     end if
>     response.write "</td>"
>    next 'c
>    counter =counter +1
>   next 'e
>   response.write "</TR>"
>  next 'd
>
> 'next 'b
>
> This write the array like
>
> 1    2    3
>
> 4    5    6
>
> 7    8
>
> But i want to write the data like
>
> 1        4        7
>
> 2        5        8
>
> 3        6
>
> Can anyone advise how to change the code to do this ?
>
> Regards, with mental block
>
> John

Let's get the disclaimers over with - it's very late where I am and
this code is completely untested *and* I can't completely understand
everything in your code ..... however I think the following will give
you enough of a flavour of what you could do to allow you to adapt it
to your own situation.

In essence you need to store the input data in an intemediate array
and then access the the 'columns' as if they were 'rows' and vica-
versa. In my code arrData is a the input data out of the database. I
store this temporarily in arrWork and then walk back over arrWork but
this time reversing the sense of 'columns' and 'rows'.

As I say it's completely untested but it might nudge you where you
need to go...

for iRow = 1 to UBound(arrData,2)
for iCol = 1 to 3
arrWork(iRow,iCol) = arrData(iRow,iCol)
iCounter = iRow
next iCol
next iRow

response.write "<table>"
for iCol = 1 to 3
response.write "<tr>"
for iRow = 1 to iCounter
response.write "<td>" & arrWork(iRow,iCol) & "</td>"
next iRow
response.write "</tr>"
response.write "</table>"







[ Post a follow-up to this message ]



    Re: Tables issue  
John Peach


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-11-07 06:17 PM

Thanks for your reply, it has nudged me lol Have a good nights sleep 

"northof40" <shearichard@gmail.com> wrote in message
news:1178884667.502337.208620@y80g2000hsf.googlegroups.com...
> On May 11, 11:19 pm, "John Peach" <john.pe...@zen.co.uk> wrote: 
>
> Let's get the disclaimers over with - it's very late where I am and
> this code is completely untested *and* I can't completely understand
> everything in your code ..... however I think the following will give
> you enough of a flavour of what you could do to allow you to adapt it
> to your own situation.
>
> In essence you need to store the input data in an intemediate array
> and then access the the 'columns' as if they were 'rows' and vica-
> versa. In my code arrData is a the input data out of the database. I
> store this temporarily in arrWork and then walk back over arrWork but
> this time reversing the sense of 'columns' and 'rows'.
>
> As I say it's completely untested but it might nudge you where you
> need to go...
>
> for iRow = 1 to UBound(arrData,2)
> for iCol = 1 to 3
> arrWork(iRow,iCol) = arrData(iRow,iCol)
> iCounter = iRow
> next iCol
> next iRow
>
> response.write "<table>"
> for iCol = 1 to 3
> response.write "<tr>"
> for iRow = 1 to iCounter
> response.write "<td>" & arrWork(iRow,iCol) & "</td>"
> next iRow
> response.write "</tr>"
> response.write "</table>"
>
>







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 03:07 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register