|
FlexCel Studio for VCL/LCL
|
Occurs when FlexCel needs to know the record count on a dataset.
property OnRecordCount: TRecordCountEvent;
__property TRecordCountEvent OnRecordCount;
|
Parameters |
Description |
|
Sender |
TFlexCelReport component sending the event. |
|
DataSet |
Dataset from which we want the record count. |
|
RecordCount |
Return the record count of "DataSet" here. |
This event can be used instead of the CalcRecordCount property when you want more control on how to count the records.
Here you will count the records yourself normally by senidng a "Select count" SQL command to the database, and returning that count in the RecordCount variable. Look at the example for more information.
Note: Assigning this event leaves the value of CalcRecordCount without meaning.
This might be a typical implementation of this event:
procedure TFTestReport.ExcelReport1RecordCount(Sender: TObject; const DataSet: TDataSet; var RecordCount: Integer); begin QCount.Open; try RecordCount:=QCountTotal.Value; finally QCount.Close; end; //finally end;
and the SQL property of QCount may be something like this:
Select count(*) as Total from table
Be sure that QCount and Dataset use the same readonly, snapshot transaction, or someone might delete a record from table after calling QCount, but before the data is passed to Excel.
|
Copyright (c) 2002-2008 TMS Software. All rights reserved.
|
|
What do you think about this topic? Send feedback!
|