Forum OpenACS Q&A: Shared label for multiple columns

I'm using a list template to display some results from an SQL query stored in a multirow with the following code:

template::list::create \
-name project_pipeline \
-multirow project_pipeline \
-elements {
proj_status {
label "Status"
}
cur_proj_count {
label "Count"
aggregate sum
aggregate_label "Total"
}
cur_proj_hours {
label "Hours"
aggregate sum
aggregate_label "Total"
}
prev_proj_count {
label "Count"
aggregate sum
aggregate_label "Total"
}
prev_proj_hours {
label "Hours"
aggregate sum
aggregate_label "Total"
}
}

What would be the best way to go about adding a shared label over some of the columns. For example I would like to have a "2009" label over cur_proj_count and cur_proj_hours and a "2009" label over prev_proj_count and prev_proj_hours.

I can't really think of a better way to explain what I need, hopefully this gets the point across.

Thanks!

Collapse
Posted by Don Baccus on
Something like ...
prev_proj_count_hours {
   label "count and hours"
   display_template "
     @project_pipeline.cur_proj_count@
     @project_pipeline.cur_proj_hours@
   "
}
You'll probably want some html in the display template, and it's evil to have html in your tcl script, but the list builder doesn't really give you a way to get around that. Hope this gives you an idea as to do what you need to do ...
Collapse
Posted by Sebastien Gerega on
Hmmm, great, thanks for that! I have managed to use that to accomplish what I need but now how would I go about displaying the aggregate sums for those columns?

Thanks again

Collapse
Posted by Brian Fenton on
Hi Sebastien,

I wrote something on sub-totalling with aggregates a few years ago - there might be something there to explain it to you. Take a look at this:

https://openacs.org/blog/one-entry?entry_id=907364

Brian