How to add dynamic Fields/Objects to a Band ?
Hi !
My problem is that:
I need to create a timetable report: when and where persons are working.
Example:
XXXXXX is an rectangle with a colour, and with some text to show info about work.
Name1 person is working 4 times, Name2 is only 2 times today.
So you can see that this report is need dynamic datas, and dynamic creation.
In every user's band I need to get person id, check it's working datas (in another dataset), and I need to draw/create some subobjects for them.
And then I need to put these objects to the MasterData Band, and I need to delete the old objects.
I trying with the FastReport example, but when I make a new band (Title Band), that is not working:
When I put the Title band, the Memo object is showed only once.
When I drop this code, the object is showed many times (.RecordCount times).
1.
why ?
2.
how to prevent this effect ?
3.
is FastReport/FreeReport supports the runtime (and band-by-band-type) report creation ?
To see what I need to do, I show it in QuickReport.
(QR is not supports the band-by-band object creation. Then I create many object, and I show/hide the needed number of them):
But I hate QR, so I need to find a solution in Freereport what I don't know ( I download it today...)
Thanx for help: ft
My problem is that:
I need to create a timetable report: when and where persons are working.
Example:
|Â Name1Â |Â XXXXXXXXXXÂ XXXXXXÂ Â Â Â Â Â XXXXXXXXXX XXXXXXXX
|Â Name2Â |Â Â Â Â Â XXXXXXXXXÂ Â Â Â Â Â Â Â Â Â Â Â Â Â XXXXXXXXXXXX
XXXXXX is an rectangle with a colour, and with some text to show info about work.
Name1 person is working 4 times, Name2 is only 2 times today.
So you can see that this report is need dynamic datas, and dynamic creation.
In every user's band I need to get person id, check it's working datas (in another dataset), and I need to draw/create some subobjects for them.
And then I need to put these objects to the MasterData Band, and I need to delete the old objects.
I trying with the FastReport example, but when I make a new band (Title Band), that is not working:
procedure TForm1.Button1Click(Sender: TObject);
var
 v: TfrView;
 b: TfrBandView;
 Page: TfrPage;
begin
 frReport1.Pages.Clear;
 frReport1.Pages.Add;        // create page
 Page := frReport1.Pages[0];
 b := TfrBandView(frCreateObject(gtBand, ''));  // create MasterData band
 b.SetBounds(20, 20, 40, 40);
 b.BandType := btMasterData;
 b.Dataset := 'frDBDataSet1';
 Page.Objects.Add(b);
 v := frCreateObject(gtMemo, '');  // create data field
 v.SetBounds(30, 30, 20, 16);
 //v.Memo.Add('[ClientDataSet1."PERSON_ID"]');
 v.Memo.Add('Anything');
 Page.Objects.Add(v);
 b := TfrBandView(frCreateObject(gtBand, ''));  // create title band
 b.SetBounds(0, 20, 0, 20);
 b.BandType := btReportTitle;
 Page.Objects.Add(b);
 frReport1.ShowReport;
end;
When I put the Title band, the Memo object is showed only once.
When I drop this code, the object is showed many times (.RecordCount times).
1.
why ?
2.
how to prevent this effect ?
3.
is FastReport/FreeReport supports the runtime (and band-by-band-type) report creation ?
To see what I need to do, I show it in QuickReport.
(QR is not supports the band-by-band object creation. Then I create many object, and I show/hide the needed number of them):
procedure TqrpReport_3018.qrb_detailBeforePrint(Sender: TQRCustomBand;
 var PrintBand: Boolean);
var
x1,x2,p,i:integer;
pid:string;
dt:TDateTime;
qrl:TQRLabel;
basetime:integer;
begin
pid:=Self.DataSet['ID'];
FPresentDS.Filtered:=False;
FPresentDS.Filter:='PERSON_ID='''+pid+'''';
FPresentDS.Filtered:=True;
p:=0;
basetime:=6*60+30;
if FPresentDS.FindFirst then begin
  repeat
   qrl:=FSubLabels[p];
   x1:=cstStartOfHLines+Trunc(((FPresentDS['INTMIN1']-basetime)/30)*cstLenOfHLines);
   x2:=cstStartOfHLines+Trunc(((FPresentDS['INTMIN2']-basetime)/30)*cstLenOfHLines);
   qrl.Left:=x1;
   qrl.Width:=x2-x1;
   qrl.Caption:=FPresentDS['INTTYPE_NAME'];
   qrl.Alignment:=taCenter;
   qrl.Color:=clYellow;
   qrl.Visible:=True;
   //qrl.Frame.Width:=1;
   qrl.BringToFront;
   inc(p);
  until not FPresentDS.FindNext;
  for i:=p to High(FSubLabels) do FSubLabels[i].Visible:=False;
end;
//Self.Tag:=pid;
PrintBand:=True;
end;
But I hate QR, so I need to find a solution in Freereport what I don't know ( I download it today...)
Thanx for help: ft