Thema: Delphi rave report: onRestore

Einzelnen Beitrag anzeigen

Benutzerbild von semo
semo

Registriert seit: 24. Apr 2004
755 Beiträge
 
Delphi 2010 Professional
 
#1

rave report: onRestore

  Alt 9. Nov 2005, 23:58
ich habe mir nen ravereport zusammengebastelt unter verwendung einer rvCustomConnection.
daten werden auch wie gewünscht angezeigt.
nur mein problem ist das folgende:

nach dem aufruf des reports, schließe ich diesen wieder und will einen neuen report mit einem anderen datensatz laden. es werden aber immer noch die daten des ersten reports angezeigt. irgendwie muss ich der connection sagen dass sie die alten daten beim rvProcejt.Close verwerfen soll, habe da was von OnRelease gelesen. Bringt aber auch nix.

hier ein Codeauszug:

Delphi-Quellcode:
procedure TMyForm.RvCustomConnection1Open(Connection: TRvCustomConnection);
begin
  // The OnOpen event is called to initialize a data session. In this event you
  // can open up data files, initialize variables and save the current state of
  // the data for the OnRestore event which will be called to terminate the
  // data session.

  RvCustomConnection1.DataRows := myList.Count;
  iRowIndex := 0;
end;
       
procedure TMyForm.RvCustomConnection1GetCols(Connection: TRvCustomConnection);
begin
  With RvCustomConnection1 do
  begin
    WriteField('lfdNr',dtString,8,'','');
    WriteField('Name',dtString,50,'','');
    WriteField('Kosten',dtString,20,'','');
  end;
end;

procedure TMyForm.RvCustomConnection1GetRow(Connection: TRvCustomConnection);
var
  sName,
  sKosten,
  sTituliert: String;
  aPerson: PPerson;
begin
  // The OnGetRow event is called to retrieve the data for the current row.
  // There are several methods used to write the data to a special buffer used
  // by Rave. The order and types of the fields written must match exactly the
  // field definitions provided in the OnGetCols event.

  aPerson := PPerson(myList[iRowIndex]);
  sName := aPerson.name;
  sKosten := aPerson.kosten;

  with RvCustomConnection1 do
  begin
    WriteStrData('', IntToStr(iRowIndex+1));
    WriteStrData('', sName);
    WriteStrData('', Format('%8.2f', [fKosten]));
  end;
end;
       
procedure TMyForm.RvCustomConnection1Next(Connection: TRvCustomConnection);
begin
  // The OnNext event is called to move the data cursor to the next row of data.

  Inc(iRowIndex);
end;

procedure TMyForm.RvCustomConnection1EOF( Connection: TRvCustomConnection;
                                                  var Eof: Boolean);
begin
  // The OnEOF event is called to return whether the data cursor is beyond the
  // EOF or not. A true value should be returned only if there are no rows or
  // if a call to the OnNext event has moved past the last row.

  EOF := iRowIndex > myList.Count-1;
end;

procedure TMyForm.RvCustomConnection1Restore(
  Connection: TRvCustomConnection);
begin
  // hier steht irgendwas damit diese procedure durchlaufen wird
  Application.ProcessMessages;
end;
jemand nen tip?
  Mit Zitat antworten Zitat