How to print just current record from grid?

I'm testing FreeReport 2.33.

I've got it printing the contents of a grid, but I just want it to print the
current record (in response to a 2-click on the grid). How do I do that?

Comments

  • edited 7:25PM
    in a database, there is always a current record. U have to set the current record 1st, then U will get want U want, I think.
  • edited 7:25PM
    Normally, just selecting a record in a grid makes it the current record. I'm responding to a double-click of the grid to run the report, but it wants to print ALL the records in the grid.

    Anybody know what I need to do to limit the report to just one record (the current one)?
  • edited 7:25PM
    Hmm, strange. I have an application, and if I select a record in DBGrid, FRreport shows that record's fields in the report.

    have no idea about the prob ;)
  • edited 7:25PM
    If I do this:

    frDBDataSet.RangeBegin := rbCurrent;
    frDBDataSet.RangeEnd := reCurrent;

    the report does begin (as it should) with the current record (the one I 2-click in the grid), but doesn't end there--it will print all of the records in the grid instead of just the one if I let it.

    With this code in the BeginPage() event:

    procedure TfViewExiters.frReportBeginPage(pgNo: Integer);
    begin
    if pgNo > 1 then
    frReport.Terminated := True;
    end;

    I can prevent all of the records from being printed, but it still prints 2
    plus (2 complete records, and starts the third before it "gets the message"
    and terminates).

    Here is my setup:
    The TfrDBDataset is connected to a data source, which is connected to a
    TpFIBClientDataset, which is connected to a TpFIBDatasetProvider, hooked to
    a TpFIBDataset. The TClientDataSetGrid shares the same data source as the
    TfrDBDataset, of course.

    My code is:

    procedure TfViewExiters.cdsGridDblClick(Sender: TObject);
    begin
    frReport.LoadFromFile('ExitInterviewRpt.frf');
    frDBDataSet.RangeBegin := rbCurrent;
    frDBDataSet.RangeEnd := reCurrent;
    frReport.ShowReport;
    end;
  • edited 7:25PM
    What about creating an other table, and before report copy only the current record to the new table, and make a report on the new table?

Leave a Comment