Question
“I have a DBText set to Suppress Repeated Values. Is it also possible to suppress other report objects located in the detail band if the DBText is a repeated value?”
Solution
Use the DetailBand.BeforePrint event to determine whether the current record value is repeated, then toggle the visibility of the other components in the band based on what you find.
Download: SuppressRepeatedShapeWithDBText.zip
Sample Delphi code:
procedure TForm1.ppDetailBand1BeforePrint(Sender: TObject);
var
lbPrintIt: Boolean;
begin
lbPrintIt := False;
if not(ppDBText1.PriorValueSame) or ((ppDBText1.DataPipeline <> nil) and (ppdaFirstRecord in ppDBText1.DataPipeline.State) and not(ppDBText1.AlreadyPrinted)) then
lbPrintIt := True
else
begin
if (ppDBText1.SuppressRepeatedValues) then
begin
if (ppDBText1.ReprintOnSubsequent) and (ppDBText1.FirstPage < ppDetailBand1.Report.Engine.AbsolutePageNo) and not(ppDBText1.AlreadyPrinted) then
lbPrintIt := True;
end
else if ppDetailBand1.OverFlow and not(ppDBText1.ReprintOnOverFlow) and not(ppDBText1.DrawComponent) then
lbPrintIt := False
else if (ppDBText1.DrawComponent) then
lbPrintIt := True;
end;