Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

Explorer ,
Feb 08, 2009 Feb 08, 2009
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
562
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 08, 2009 Feb 08, 2009
Get everything into a single query and use the group attribute of cfoutput.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 09, 2009 Feb 09, 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 09, 2009 Feb 09, 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?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 09, 2009 Feb 09, 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 10, 2009 Feb 10, 2009
LATEST
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/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources