Master-detail reports are slow when using 3rd party datasets and DataSetConnections

Category

Rave - Data Connections

Question

I'm using a 3rd party dataset with DataSetConnection components. The single table reports are very fast, but the master-detail reports are much slower.

Solution

Rave defaults to internal filtering for master-detail reports if you don't provide an OnSetFilter event on your detail dataset connections. For SQL based reports, I would recommend joining your tables into a single result set for best performance and using group headers/footers in the report to print the master table information and the databand to print the detail table information.

For non-SQL reports, you should define an OnSetFilter event on each of your detail dataset connection components (in your application). Here is some help on that code:

While Connection.GetFilterItem do begin
 // Connection.FilterFieldName returns the field name to filter on
 // Connection.FilterFieldData returns the data to filter on
 end; { while }

Basically, you would call GetFilterItem until it returns false. Each call to GetFilterItem returns a field name (Connection.FilterFieldName) and the data (Connection.FilterFieldData) that the field should be filtered on. Multiple calls to GetFilterItem would occur if the DetailKey or MasterKey properties in the Rave report include multiple key fields. FilterFieldName and FilterFieldData will be set to the detail field name to filter on and the data value to filter on.

Example: If the master table was on a record with a key value of ABC, the FilterFieldData property will return ABC and you should do whatever is most efficient for your database system to filter the detail table based on the field named FilterFieldName (e.g. ItemKey) for the value FilterFieldValue (e.g. ABC).

Lookups in Rave also use the OnSetFilter events.