simple master detail report in embarcadero cbuilder.

edited December 2012 in FastReport 4.0
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.


Comments

  • edited 12:13AM
    o.k. i think i have it working as it should now i created a datasource for the master dataset and specified that as the datasource of the detail set, then i doubleclicked on the masterfields property (of the detail ADODATASET, not the frxDBDataset) and set the right field for it.
  • edited 12:13AM
    mithcd wrote: »

    Hi, I want to ask on where you got this? Is the tutorial available somewhere?

    the user manual:
    if it's not installed on your machine then just google: "fastreport 4 users manual"
  • gpigpi
    edited 12:13AM
  • 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.

Leave a Comment