Hi All,
I have a TObjectList that I am using to generate a report from. When the
list is empty I would still like to print the report, just not to have any
data printed in the detail band. I have just upgraded to RB 6.X and I have
D5 with SP1.
Thanks.
- KenA
Comments
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
I tried that but I get a "List index out of bounds (0)" exception. It seems
as if RB is still trying to fetch the first record. Perhaps I am not
telling RB the number of records in the TObjectList at the right time. My
code for doing that is shown below. I make a new pipeline from JITPipeline
and I override the OpenDataSet event. It is here that I set the JITPipeline
property RecordCount. I have followed this paradigm for a number of JIT
reports and never had a problem until I came across this report that may
have zero records.
Thanks for your comments
- KenA
///////////////// class defination
TOasListPipeline = class(TppJITPipeline)
protected
FObjectList: TObjectList;
procedure OpenDataSet; override;
public
constructor Create(Owner: TComponent; ObjectList: TObjectList);
reintroduce; virtual;
property List: TObjectList read FObjectList;
end;
////////////// class implementation. user must supply an object list
constructor TOasListPipeline.Create(Owner: TComponent; ObjectList:
TObjectList);
begin //
inherited Create(Owner);
FObjectList := ObjectList;
if FObjectList = nil then
raise Exception.Create('TOasListPipeline.Create: List is nil');
end; // TOasListPipeline.Create
procedure TOasListPipeline.OpenDataSet;
begin //
if FObjectList = nil then
raise Exception.Create('TOasListPipeline.Create: List is nil');
inherited;
InitialIndex := 0;
RecordCount := FObjectList.Count;
end; // TOasListPipeline.OpenDataSet
it tries to retrieve the first record? My test report seems to work for a
JIT with no data. Perhaps, send us a simple example to
support@digital-metaphors.com and we'll check it out.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com