SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2010
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    grouping an array

    Hi all,
    I have a dynamic two dimensional array. The array returns more than 200 records.
    I need to divide the array into 50 rows and create a table for each 50 rows.
    so 200/50 = 4

    cols = ubound(myarray,1)
    rows = ubound(myarray,2)


    colStart = lbound(myarray, 1)
    colEnd = ubound(myarray, 1)
    rowStart = lbound(myarray, 2)
    rowEnd = ubound(myarray, 2)

    numberoftable = ubound(myarray, 2)/50 - this will tell me how many tables I need.

    This gives me all the 200 rows. How do I break this into 4 groups

    For row=rowStart to rowEnd
    For col=colStart to colEnd
    ' write columns
    Nex
    Next

    Any help is greatly appreciated.
    Thank you,
    John

  2. #2
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,608
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Pseudo-code ...

    Code:
    newTable = False
    Response.Write "<table>"
    For row = rowStart to rowEnd
      If row mod 50 = 0 And row > 1 Then 'New table at 0,50,100,150
        newTable = True
        Response.Write "<table>"
      End if
      Response.write "<tr>"
      For col = colStart to colEnd
    '    write columns
      Next 'col
      Response.write "</tr>"
      If newTable Then
        Response.write "</table>"
        newTable = False
      End if
    Next 'row
    If Not newTable Then Response.Write "</table>" 'Might not need this line
    That should give you something to work from - hopefully.
    Ian Anderson
    www.siteguru.co.uk

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2010
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you so much. This works!!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •