multi reports
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
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
This discussion has been closed.
Comments
http://www.digital-metaphors.com/tips/JITWithSenderInEvents.zip
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
the new TmyJITPipeline makes it easier.
Cheers
Martin Cremer