Printing group header mid-page when grouping changes mid-page
I know I'm overlooking something obvious.
I've got a single query result with records ordered by Segment and Type.
I want to print a header each time I reach a new Segment or new Type
within that Segment, even if the group break occurs mid-page, in which
case I want the group header to appear mid-page.
So, it would look something like this:
Page Header 1
Group Header Segment1
Group Header Type1
Detail
...
Detail
Group Footer Type1
Group Header Type2
Detail
...
Detail
Group Footer Type2
Group Footer Segment1
Group Header Segment2
Group Header Type1
Detail
...
Detail
Group Footer Type1
Group Header Type2
Detail
...
Detail
Group Footer Type2
Group Header Segment2
Group Header Type1
Detail
...
Detail
Page Footer 1
Page Header 2
Group Header Segment 2 (this is a repeat current group header)
Group Header Type1 (this is a repat of the current group header)
Detail
...
Detail
Group Header Type1
Group Header Type2
Detail
...
Detail
Group Footer Type2
Group Footer Segment 3
...
and so on
I can even base the grouping on a variable consisting of Segment + Type,
in which case the grouping is simpler. Similar to this:
Page Header 1
Group Header Segment1Type1
Detail
...
Detail
Group Footer Segment1Type1
Group Header Segment1Type2
Detail
...
Detail
Group Footer Segment1Type2
Group Header Segment2Type1
Detail
...
Detail
Page Footer 1
Page Header 2
Group Header Segment2Type1 (this is a repeat current group header)
Detail
...
Detail
Group Footer Segment2Type1
...
and so on
In the detail band I've placed a region (to keep together) the fields of
the record. In the Type header (the inner header band) I've placed a
variable that displays the value of Type and Segment (this value is set
on the OnCalc event). The problem is that the header never prints
mid-page. Yes, the group advances mid-page, but the group header only
ever prints at the top of the page. I've fiddled with the various
properties such as ReprintOnOverFlow and ReprintOnSubsequent, to no avail.
I've tried different designs where the details records are printed in a
subreport, but that also does not produce the effect I'm looking for.
How do I get the group header to print mid-page when the grouping
changes mid-page?
Thanks in advance for your help
-Cary
I've got a single query result with records ordered by Segment and Type.
I want to print a header each time I reach a new Segment or new Type
within that Segment, even if the group break occurs mid-page, in which
case I want the group header to appear mid-page.
So, it would look something like this:
Page Header 1
Group Header Segment1
Group Header Type1
Detail
...
Detail
Group Footer Type1
Group Header Type2
Detail
...
Detail
Group Footer Type2
Group Footer Segment1
Group Header Segment2
Group Header Type1
Detail
...
Detail
Group Footer Type1
Group Header Type2
Detail
...
Detail
Group Footer Type2
Group Header Segment2
Group Header Type1
Detail
...
Detail
Page Footer 1
Page Header 2
Group Header Segment 2 (this is a repeat current group header)
Group Header Type1 (this is a repat of the current group header)
Detail
...
Detail
Group Header Type1
Group Header Type2
Detail
...
Detail
Group Footer Type2
Group Footer Segment 3
...
and so on
I can even base the grouping on a variable consisting of Segment + Type,
in which case the grouping is simpler. Similar to this:
Page Header 1
Group Header Segment1Type1
Detail
...
Detail
Group Footer Segment1Type1
Group Header Segment1Type2
Detail
...
Detail
Group Footer Segment1Type2
Group Header Segment2Type1
Detail
...
Detail
Page Footer 1
Page Header 2
Group Header Segment2Type1 (this is a repeat current group header)
Detail
...
Detail
Group Footer Segment2Type1
...
and so on
In the detail band I've placed a region (to keep together) the fields of
the record. In the Type header (the inner header band) I've placed a
variable that displays the value of Type and Segment (this value is set
on the OnCalc event). The problem is that the header never prints
mid-page. Yes, the group advances mid-page, but the group header only
ever prints at the top of the page. I've fiddled with the various
properties such as ReprintOnOverFlow and ReprintOnSubsequent, to no avail.
I've tried different designs where the details records are printed in a
subreport, but that also does not produce the effect I'm looking for.
How do I get the group header to print mid-page when the grouping
changes mid-page?
Thanks in advance for your help
-Cary
This discussion has been closed.
Comments
By default, a group is set to KeepTogether when it is created. Be sure this
property is set to False as well as the NewPage property. Both these
properties could be causing a new group to start on a new page once the
previous one has finished.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
The KeepTogether property of the group is set to False. Likewise, none
of the checkboxes in the Break On area of the Groups dialog box is set.
I do have the Reprint group headers on subsequent pages checkbox checked.
When I preview the report, the group changes mid-page (I can tell from
data in the detail section), but the group header does not print. The
group header's Visible property is True.
The group header is only printing at the top of the page, below the page
header. I need the group header to print each time the group changes, as
well as at the top of each page.
In my current report I have a single group based on a customer field,
which is a variable. I have an OnCalc event handler that sets the value
of the variable to Segment + ' ' + Type.
Recall, I am using a single dataset. I suspect that I could create a
master-detail relationship, but that would require the extra step of
executing two queries, as opposed to one, and I imagine I should be able
to do this with a single result set.
Any additional ideas?
-Cary
Sorry, I was under the impression you were using the first method you
mentioned in your first post.
When grouping on a variable value, the OnCalc event will not work to
properly break the group at the correct time. The value of the variable
needs to be set in the Group.OnGetBreakValue event to ensure the correct
timing.
Another option would be to create a Calc field in your dataset and group on
that field.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I'd done it several ways, including the first. My current version used
the second.
I created a new field with the calculation in my query, as you
suggested, and now the group headers work correctly. I really don't know
what I was doing wrong in my first couple of takes, given that this was
such a simple report, but the good news is that it's working correctly now.
Thanks, Nico
-Cary
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com