using two different dataset?

edited December 2004 in FastReport 3.0
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.

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 10:15PM
    use 2 master bands with headers footers for each.
    ;)
  • edited 10:15PM
    thanks @gordk,

    Best Regards.
  • edited May 2007
    Hi,

    I have same problem, i want to list 2 differents table, no relations between them, here is the code i use :
    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,

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.