Skip to main content
Known Participant
February 8, 2009
Question

Splitting data into two tables then alternating the two tables down the page

  • February 8, 2009
  • 4 replies
  • 590 views
I've got a table of statistics shown by week but it's getting a little crowded.

I'd like to be able to split it into two separate tables - summary and then breakdown of part of the statistics. The table is using lots of array notation and I'm not sure how to repeat ['currentRow']

Example (using | to separate cells in table)
Currently

Term1
Wk 1 | Total bookings | R values | F+ P values | U + L values | NW + NU values | NS values | WE + WR + WT
Wk 2 | Total bookings | R values | F+ P values | U + L values | NW + NU values | NS values | WE + WR + WT
...
Term 2
Wk 1 | Total bookings | R values | F+ P values | U + L values | NW + NU values | NS values | WE + WR + WT
Wk 2 | Total bookings | R values | F+ P values | U + L values | NW + NU values | NS values | WE + WR + WT
...


What I'd like to get is something along the lines of
Term 1 Summary
Wk 1 | Total bookings | R values | F+ P values |
Wk 2 | Total bookings | R values | F+ P values |

Term 1 Details
Wk1 | U + L values | NW + NU values | NS values | WE + WR + WT
Wk2 | U + L values | NW + NU values | NS values | WE + WR + WT

Term 2 Summary
.....


I guess the bit i'm most unsure about at the moment is how to repeat the row of data across the two tables.

Any pointers most welcome
Any questions to work out what I'm talking about also welcome

Thanks
Michael
    This topic has been closed for replies.

    4 replies

    Participating Frequently
    February 11, 2009
    Take one query and "query the query" to get the data out of it for each side that you need.

    http://www.sitepoint.com/article/query-queries/
    Known Participant
    February 9, 2009
    I thought that may be the answer!

    SELECT YEARWEEK(b.bookingDate, 5) AS bookingYearWeek,

    gives me the week number of the year then I have another table and QoQ to rename it as term and week
    Inspiring
    February 9, 2009
    You can't have alternating html tables. You can have multiple tables if you want. Or you can use the same table and use rowspan and colspan attributes to change the appearance. Or you can have nested tables.

    However, your query does not seem to provide what your OP said you wanted. Which of the fields in your select clause represents the Term Number?
    Inspiring
    February 8, 2009
    Get everything into a single query and use the group attribute of cfoutput.
    Known Participant
    February 9, 2009
    The data is in one query - shown below and has a QofQ to replace the week numbers with the week names i'm wanting to use.

    Cfoutput group looks like it will separate terms (in a better way than I am at the moment) but I can't see how I'll be able to create 2 alternating tables from the one query

    I've created 2 images

    http://www-users.york.ac.uk/~mbj101/old.jpg shows the old style (manual) that I'd like to recreate. What's shown then loops through each term

    http://www-users.york.ac.uk/~mbj101/new.jpg shows the new style that I'd like to split to something like above..

    Thanks
    Michael