Help - Search - Members - Calendar
Full Version: using two different dataset?
Fast Reports forum > Fast Reports Products > FastReport 3.0
carpe_diem
Hi,

i want to use 2 different dataset in a report? How can i do this?

my report like this :

title
dataset 1 column headers
dataset 1 records
dataset 2 column headers
dataset 2 records
footer

P.S. these dataset not a master-detail dataset, they doesn't have master-detail relationship.

Best Regards.
gordk
use 2 master bands with headers footers for each.
wink.gif
carpe_diem
thanks @gordk,

Best Regards.
pasnox
Hi,

I have same problem, i want to list 2 differents table, no relations between them, here is the code i use :

CODE
function printIntervention( pNumClient: Variant; pIdIntervention: Integer; pShow: Boolean = True ): Boolean;
var
  p: TUIFreeReportPreviewer;
  q: TIBQuery;
  d: TfrDBDataSet;
begin
  Result := False;
  p := TUIFreeReportPreviewer.Create( nil );
  p.lPrintType := [ptIntervention];
  p.lReportFilePath := p.lReportFilePath + 'Intervention.frf';
  p.Hint := 'LogicAlarm - Impression Intervention';
  //
  with p.qCustom do
  begin
    SQL.Text := 'SELECT DATE_TI, START_HOUR_TI, END_HOUR_TI, ' +
      'FAMILY_NAME_TECHNICIAN || '' '' || NAME_TECHNICIAN AS FULL_NAME_TECHNICIAN ' +
      'FROM TECHNICIANS_INTERVENTION ' +
      'INNER JOIN TECHNICIANS ON ID_TECHNICIAN_TI = ID_TECHNICIAN ' +
      'AND ID_INTERVENTION_TI = :idinter';
    Params[0].AsInteger := pIdIntervention;
  end;
  //
  q := newQuery;
  with q do
  begin
    SQL.Text := 'SELECT ART_REFERENCE, ART_DESIGNATION, QTY_ARTICLE_MI, ' +
      'BILLABLE_ARTICLE_MI ' +
      'FROM MATERIAL_INTERVENTION ' +
      'INNER JOIN ARTICLES ON ART_NUM_ARTICLE = NUM_ARTICLE_MI ' +
      'AND ID_INTERVENTION_MI = :idinter';
    Params[0].AsInteger := pIdIntervention;
  end;
  // if file not exists, cancel
  if ( not FileExists( p.lReportFilePath ) ) then
  begin                                              
    ShowMessage( Format( 'L''etat %s n''existe pas, annulation.', [ p.lReportFilePath ] ) );
    p.Release;
    q.Free;
    Exit;
  end;
  p.frReport.Title := p.Hint;
  // prepare queries
  p.prepareQueries( pNumClient );
  p.qCustom.Open;
  q.Open;
  if ( not ( p.qCustom.Eof and q.Eof ) ) then
  begin
    p.seCopyNumber.Value := 1;
    //
    p.frDBDataSet.DataSet := p.qCustom;
    d := TfrDBDataSet.Create( p );
    d.Name := 'frDB';
    d.DataSet := q;
    // load report
    p.frReport.LoadFromFile( p.lReportFilePath );
    TfrBandView( p.frReport.FindObject( 'materialDatas' ) ).DataSet := d.Name;
    // prepare repart
    p.finishPrepareReport;
    Result := p.previewReport( pShow );
  end
  else
    ShowMessage( NO_DATA );
  // liberation memoire
  if ( Assigned( p ) ) then
    p.Release;
  // free memory
  q.Free;
  d.Free;
end;


In the TfreeReportPreviewer class there is already a frDBDataset nammed frDBDataset, so i'm just creating a new one on the fly in the code below, what's wrong ?!

The app crash telling "row name" not available, because it try to loads datas from first dataset, why ?!

Thanks, P@sNox,
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.