How to find the detail count?
I am trying to show a sub-report that has title and detail bands. I have a
variable that I increase in the detail band, so that it show a numbered
list.
If there is only one record in the detail band, then I want to hide the
variable, since a numbered list with only one item looks a bit odd. I've
tried all sorts of things, but can't seem to get it to work.
I tried a DBcalc in the title section, set to lookahead and count the items
in the detail section which it does show correctly in the title, but it
seems not to look ahead until afterward, since when I try to decide whether
to show my number variable, the value of the DBcalc seems to increment as it
goes through the report.
How can I achieve what I want?
Regards
Jeremy Knowles
variable that I increase in the detail band, so that it show a numbered
list.
If there is only one record in the detail band, then I want to hide the
variable, since a numbered list with only one item looks a bit odd. I've
tried all sorts of things, but can't seem to get it to work.
I tried a DBcalc in the title section, set to lookahead and count the items
in the detail section which it does show correctly in the title, but it
seems not to look ahead until afterward, since when I try to decide whether
to show my number variable, the value of the DBcalc seems to increment as it
goes through the report.
How can I achieve what I want?
Regards
Jeremy Knowles
This discussion has been closed.
Comments
the group is located inside of the subreport. You can resize the group
header and group footer to be zero height, and base the group on a custom
field such as a label to get a group around the entire subreport.
Essentially, you'll need to get a event to yank the draw command when the
subreport is finished. This may be possible by using a summary band of zero
height in the subreport. It won't print, but its BeforePrint event handler
should fire and do that same job as the group footerband. Now that I think
about it, the summary in a subreport is the way to go on this event handler,
forget creating a group since you don't need it.
http://www.digital-metaphors.com/tips/HideVarWhenOneRec.zip
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
There is one thing though. I put the stuff in the summary band AfterPrint
event, and it works fine except when there is some at the bottom of the
previous page and only one detail that goes onto the next page, in which
case Detail.Count = 1 so the variable is hidden when it should be shown.
I got round it by making the sub-report keep together which forces them all
onto the next page, but it would be nicer to fix it.
Thanks again, this product and support is fantastic, but then I guess you
know that - one more comment doesn't harm though, eh?
Jeremy
the subreport which never breaks. Create the group on a custom field, such
as a static text TppLabel.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com