Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

multi reports

edited May 2003 in General
I would like to know, if there is a "hidden" tech tip for this structure
somewhere.

My goal is save the structure of one report in a database. The structure is
known and always the same. During runtime I know that there are for instance
99 reports with different datas to create. I combine these reports via tech
tip "subreference" to only one big report. But unfortunately I have to use
99 JITPipelines and I run into trouble in the OnGetField event. I'm missing
a Sender component. There is only a string variable aFieldName. The only
chance I see is to manipulated the fieldnames as I show in the testcode
snippet.

function TForm1.GetNominalDataFieldValue(const aFieldName: string): Variant;
var
lsFieldName: string;
NbrStr : string;
I : Integer;
Pipeline : TppJITPipeline;
S : TStCollection;
begin
lsFieldName := Uppercase(aFieldName);
NbrStr := Copy(lsFieldName, Length(lsFieldName), 1);
I := StrToInt(NbrStr);

Pipeline := lNominalDataPipeline[I];
S := lStNominalDataColl[I];

if lsFieldName = 'NOMINALDATAFIELD1' + NbrStr then
Result := PrintRec(S[Pipeline.RecordIndex])^.LeftMarginText
else if lsFieldName = 'NOMINALDATAFIELD2' + NbrStr then
Result := PrintRec(S[Pipeline.RecordIndex])^.RightMarginText
else if lsFieldName = 'NOMINALDATAFIELD3' + NbrStr then
Result := PrintRec(S[Pipeline.RecordIndex])^.GroupIndex
else
Result := '';
end;

This code is working but from my point of view terrible coding. A chance to
improve this one?

Thanks

Martin Cremer

Comments

This discussion has been closed.