This can be done with a two pass report. During the first pass inside the Group.AfterBreak event, increase a global variable keep track of the total group breaks. Note that the code below is rough psuedo code and may need to be changed for your specific report.
procedure Group1AfterGroupBreak; begin if Report.FirstPass then gGroupBreakCount := gGroupBreakCount + 1; end;
Then during the second pass inside the GroupFooter.BeforePrint event check to see that the total group break count is equal to the current break number - 1 then assign the visible property of the line.
procedure GroupFooterBand1BeforePrint; begin if Report.SecondPass then begin if Group1.BreakNo = gGroupBreakCount - 1 then Line1.Visible := False; end;
Il 19/06/2012 22:02, Nico Cizik (Digital Metaphors) ha scritto:
Hi Niko, some problems about the code you sent me :
1) I forgot to tell you that the group is in a subreport. Is the same ?
Howevere I try to write the following code in a SubReport:
In the section GlobalVariables of the subreport i define the following global variable :
var gGroupBreakCount: Integer;
and then i put the code you sent me in the event group :
procedure Group5AfterGroupBreak; if Report.FirstPass then gGroupBreakCount := gGroupBreakCount + 1; end;
line 1 procedure GroupFooterBand5BeforePrint; line 2 begin line 3 if Report.SecondPass then line 4 begin line 5 if Group5.BreakNo = gGroupBreakCount - 1 then line 6 Line7.Visible := False; line 7 end; line 8 end;
The compiler show me an error :
Error GroupFooterBand5BeforePrint: line 5, incompatible types
Il 21/06/2012 00:03, Nico Cizik (Digital Metaphors) ha scritto: Hi Nico, i try placing the gGroupBreakCount - 1 in parentheses and haven't compiling error. But i have a problem with the last record. You can omit the dot line in the AfterFooterGroup when the last group is printed ? Here is an example : 1 1 1 -------- dot line in footer band 2 2 -------- dot line in footer band 3 3 -------- in the last is possible not print the line ?
Il 22/06/2012 18:09, Nico Cizik (Digital Metaphors) ha scritto:
Hi Nico, i have seen that your simple example works fine. However, my report does not work. The difference between my report and your example is that the group, in my report, is in a subreport. I set two pass either in report and subreport. Any suggestions ?
I will need to see this in action. Please either alter the example I sent you or create a simple example of your own I can run here so that I can see the behavior you are describing.
Send the example in .zip format to support@digital-metaphors.com.
Comments
Hi,
the problem is on RAP.
I post in a wrong newsgroup,
the right newsgroup is digital-metaphors.public.reportbuilder.rap
Sorry to mismatch.
Bye
This can be done with a two pass report. During the first pass inside
the Group.AfterBreak event, increase a global variable keep track of the
total group breaks. Note that the code below is rough psuedo code and
may need to be changed for your specific report.
procedure Group1AfterGroupBreak;
begin
if Report.FirstPass then
gGroupBreakCount := gGroupBreakCount + 1;
end;
Then during the second pass inside the GroupFooter.BeforePrint event
check to see that the total group break count is equal to the current
break number - 1 then assign the visible property of the line.
procedure GroupFooterBand1BeforePrint;
begin
if Report.SecondPass then
begin
if Group1.BreakNo = gGroupBreakCount - 1 then
Line1.Visible := False;
end;
end;
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Hi Niko,
some problems about the code you sent me :
1) I forgot to tell you that the group is in a subreport. Is the same ?
Howevere I try to write the following code in a SubReport:
In the section GlobalVariables of the subreport i define the following
global variable :
var
gGroupBreakCount: Integer;
and then i put the code you sent me in the event group :
procedure Group5AfterGroupBreak;
if Report.FirstPass then
gGroupBreakCount := gGroupBreakCount + 1;
end;
line 1 procedure GroupFooterBand5BeforePrint;
line 2 begin
line 3 if Report.SecondPass then
line 4 begin
line 5 if Group5.BreakNo = gGroupBreakCount - 1 then
line 6 Line7.Visible := False;
line 7 end;
line 8 end;
The compiler show me an error :
Error GroupFooterBand5BeforePrint: line 5, incompatible types
Any suggestions ?
Thank you
Mauro Catellani
if Group1.BreakNo = (gGroupBreakCount - 1) then
...
Be sure you set the PassSetting of the report to psTwoPass.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Hi Nico,
i try placing the gGroupBreakCount - 1 in parentheses and
haven't compiling error.
But i have a problem with the last record.
You can omit the dot line in the AfterFooterGroup when the last group is
printed ?
Here is an example :
1
1
1
-------- dot line in footer band
2
2
-------- dot line in footer band
3
3
-------- in the last is possible not print the line ?
Thank you
Mauro
Below is a link to the simple example I created. Notice that the line
disappears for the last group.
http://www.digital-metaphors.com/tips/HideLastGroupLine.zip
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Hi Nico,
i have seen that your simple example works fine.
However, my report does not work.
The difference between my report and your example is that the group, in
my report, is in a subreport.
I set two pass either in report and subreport.
Any suggestions ?
Thank you.
sent you or create a simple example of your own I can run here so that I
can see the behavior you are describing.
Send the example in .zip format to support@digital-metaphors.com.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Hi Niko,
i send you the example in .zip format to support@digital-metaphors.com.
Best regards.