Discussion:
Help with RvCustomConnection and BDS 2006
(too old to reply)
Vincent
2006-11-13 19:23:46 UTC
Permalink
I am obviously missing somthing here but I can not get Rave to report
anything.

I created a simple test program to see if I can figure this out.

First I created a simple data structure to hold the data I wanted reported
on:

TPrinterReportRec = Record
ToName : string;
FromName : String;
TradeID : String;
TransCount : Integer;
Rate : Real;
NetTrans : Integer;
end;
TPrinterReportList = Array of TPrinterReportRec;

I created the needed functions to populate that with some data. Then I added
a "RvCustomConnection" vai the Borland IDE to my poject. I also added a
RvSystem and a RvProject. Then I created the OnEOF,
First,GetCols,GetRow,Next,Open, Restore procedures and linked them to the
RvCustomConnection as per the docs I found at
http://www.nevrona.com/files/ravedevguide5.pdf

Here is GetCols and GetRow:

//*******************************************************************
Procedure TPrinterDataModule.RvCustomConnection1GetCols(
Connection: TRvCustomConnection);
Begin
with Connection do begin
WriteField('ToName', dtString, 255, 'ToName', 'ToName');
WriteField('FromName', dtString, 255, 'FromName', 'FromName');
WriteField('TradeID', dtString, 255, 'TradeID', 'TradeID');
WriteField('TranCount', dtInteger, 11, 'TranCount', 'TranCount');
WriteField('Rate', dtFloat, 11, 'Rate', 'Rater');
WriteField('NetCount', dtInteger, 11, 'NetCoun', 'NetCoun');
end; //with
End;

//*******************************************************************
Procedure TPrinterDataModule.RvCustomConnection1GetRow(
Connection: TRvCustomConnection);
begin
with Connection do begin
WriteStrData(ReportTable[CurRecord].ToName,ReportTable[CurRecord].ToName);
WriteStrData(ReportTable[CurRecord].FromName,ReportTable[CurRecord].FromName);
WriteStrData(ReportTable[CurRecord].TradeID,ReportTable[CurRecord].TradeID);
WriteIntData('',ReportTable[CurRecord].TransCount);
WriteFloatData('',ReportTable[CurRecord].Rate);
WriteIntData('',ReportTable[CurRecord].NetTrans);
end; //with
end;


Using the Rave interface I created a simple report, and added a Dataview
that was linked to my RvCustomConnection. I then created a Databand and
linked it to the Dataview, and added a DataText component which I set to the
Dataview with a DataField of "ToName". Back in my code I call the Rave
report like this...

RvProject.Open;
RvProject.SelectReport('SimpleReport',False);
RvProject.Execute;
RvProject.Close;

When I run it, it brings up a window that lets me choose between
Print/Preview/etc. I pick Preview and I get the preview screen, but the
report is completely blank.

I also do not get a field listing in Rave after following the directions in
this documentation :
http://www.nevrona.com/Default.aspx?tabid=67

When I trace it, GetCol, Next, and EOF are all called, but GetRow is never
called.

Any idea what I am missing here? Rave version 6.5 with BDS 2006.

Thanks!
Vincent
Vincent
2006-11-15 16:25:28 UTC
Permalink
Never mind, found the error. Simple typo in the EOF function:

I had
Result := CurRecord <= Length(TheData);
instead of
Result := CurRecord >= Length(TheData);

ops :)

Works fine now.
Post by Vincent
I am obviously missing somthing here but I can not get Rave to report
anything.
I created a simple test program to see if I can figure this out.
First I created a simple data structure to hold the data I wanted reported
TPrinterReportRec = Record
ToName : string;
FromName : String;
TradeID : String;
TransCount : Integer;
Rate : Real;
NetTrans : Integer;
end;
TPrinterReportList = Array of TPrinterReportRec;
I created the needed functions to populate that with some data. Then I
added a "RvCustomConnection" vai the Borland IDE to my poject. I also
added a RvSystem and a RvProject. Then I created the OnEOF,
First,GetCols,GetRow,Next,Open, Restore procedures and linked them to the
RvCustomConnection as per the docs I found at
http://www.nevrona.com/files/ravedevguide5.pdf
//*******************************************************************
Procedure TPrinterDataModule.RvCustomConnection1GetCols(
Connection: TRvCustomConnection);
Begin
with Connection do begin
WriteField('ToName', dtString, 255, 'ToName', 'ToName');
WriteField('FromName', dtString, 255, 'FromName', 'FromName');
WriteField('TradeID', dtString, 255, 'TradeID', 'TradeID');
WriteField('TranCount', dtInteger, 11, 'TranCount', 'TranCount');
WriteField('Rate', dtFloat, 11, 'Rate', 'Rater');
WriteField('NetCount', dtInteger, 11, 'NetCoun', 'NetCoun');
end; //with
End;
//*******************************************************************
Procedure TPrinterDataModule.RvCustomConnection1GetRow(
Connection: TRvCustomConnection);
begin
with Connection do begin
WriteStrData(ReportTable[CurRecord].ToName,ReportTable[CurRecord].ToName);
WriteStrData(ReportTable[CurRecord].FromName,ReportTable[CurRecord].FromName);
WriteStrData(ReportTable[CurRecord].TradeID,ReportTable[CurRecord].TradeID);
WriteIntData('',ReportTable[CurRecord].TransCount);
WriteFloatData('',ReportTable[CurRecord].Rate);
WriteIntData('',ReportTable[CurRecord].NetTrans);
end; //with
end;
Using the Rave interface I created a simple report, and added a Dataview
that was linked to my RvCustomConnection. I then created a Databand and
linked it to the Dataview, and added a DataText component which I set to
the Dataview with a DataField of "ToName". Back in my code I call the
Rave report like this...
RvProject.Open;
RvProject.SelectReport('SimpleReport',False);
RvProject.Execute;
RvProject.Close;
When I run it, it brings up a window that lets me choose between
Print/Preview/etc. I pick Preview and I get the preview screen, but the
report is completely blank.
I also do not get a field listing in Rave after following the directions
http://www.nevrona.com/Default.aspx?tabid=67
When I trace it, GetCol, Next, and EOF are all called, but GetRow is never
called.
Any idea what I am missing here? Rave version 6.5 with BDS 2006.
Thanks!
Vincent
Loading...