simple master detail report in embarcadero cbuilder.
hi. im new to fastreports and have tried to make a master detail report in rad studio C++, it works in the sense that it shows the master and detail data,however all the detail data shows up for every record in the master table. how do i specify the relationship so that the master record with "levid" x will only show detail records with "levid" x and not all detail records?
the manual says i need to :
Set the
???MasterSource = DataSource1??? property in the ???Table2??? component on the (Delphi) form.
Now, we have set a ???master-detail??? connection. After that, we select the fields to link on.
Set the ???MasterFields??? property of the ???Table2??? component
i cannot find either of these properties in Cbuilder or delphi 2010 and XE3.
the manual says i need to :
Set the
???MasterSource = DataSource1??? property in the ???Table2??? component on the (Delphi) form.
Now, we have set a ???master-detail??? connection. After that, we select the fields to link on.
Set the ???MasterFields??? property of the ???Table2??? component
i cannot find either of these properties in Cbuilder or delphi 2010 and XE3.
Comments
the user manual:
if it's not installed on your machine then just google: "fastreport 4 users manual"
http://www.fast-report.com/en/download/fast-report-vcl/
An alternative:
TfrxDBDataset events OnFirst and OnNext can be used to filter the detail dataset for each row of the master dataset, something like this in cpp builder:
void __fastcall TRMovimientosPorFactura047::frxFacturasFirst(TObject *Sender) { CachedQueryMovimientos->Filter = Format("FacturaId = %u", ARRAYOFCONST((CachedQueryFacturas->FieldByName("FacturaId")->AsLongWord))); CachedQueryMovimientos->Filtered = true; CachedQueryMovimientos->First(); } //--------------------------------------------------------------------------- void __fastcall TRMovimientosPorFactura047::frxFacturasNext(TObject *Sender) { CachedQueryFacturas->Next(); CachedQueryMovimientos->Filter = Format("FacturaId = %u", ARRAYOFCONST((CachedQueryFacturas->FieldByName("FacturaId")->AsLongWord))); CachedQueryMovimientos->Filtered = true; CachedQueryMovimientos->First(); } //---------------------------------------------------------------------------
(For context: CachedQueryMovimientos is my detail dataset and CachedQueryFacturas the master dataset)
Not quite sure how much of a performance overhead this might be, but so far is working pretty well for me.