Filtering data set and subreport autostop flag
Hi
I have a report with 2 subreports and 3 datasets. The first dataset is used
on the main report, the second is for the 1st subreport and the 3rd dataset
is for the 2nd subreport.
For each line printed on the main report I filter the 2nd dataset and then
display this in subreport 1 - no problems with this. Then for each line
printed in subreport 1 I filter the 3rd dataset and display that in
subreport 2. This is were my problems begin.
Note - the filtering of the data set is being done on the GetText event of
the first field of each row.
The filtering of dataset 3 could mean that there is no data to display this
resulted in the report creating pages after pages after pages.........
I fixed this by setting the SubReport.AutoStop to True.
However if there is data only one row is being displayed because, i think of
the AutoStop?
If this is the case when is the best time to set this flag dependant on the
filtered data?
If there is a simpler way of doing it, please advise
Cheers
George
I have a report with 2 subreports and 3 datasets. The first dataset is used
on the main report, the second is for the 1st subreport and the 3rd dataset
is for the 2nd subreport.
For each line printed on the main report I filter the 2nd dataset and then
display this in subreport 1 - no problems with this. Then for each line
printed in subreport 1 I filter the 3rd dataset and display that in
subreport 2. This is were my problems begin.
Note - the filtering of the data set is being done on the GetText event of
the first field of each row.
The filtering of dataset 3 could mean that there is no data to display this
resulted in the report creating pages after pages after pages.........
I fixed this by setting the SubReport.AutoStop to True.
However if there is data only one row is being displayed because, i think of
the AutoStop?
If this is the case when is the best time to set this flag dependant on the
filtered data?
If there is a simpler way of doing it, please advise
Cheers
George
This discussion has been closed.
Comments
The preferred technique is to define a linking relationship between the
data. See article below.
The filtering technique you are using is not giong to work - due to timing.
You can try moving it the OnRecordPosition change of the master pipeline.
That might work, you will have to test.
------------------------------------------------------
Tech Tip: Linking SQL Queries for Master/Detail Data
------------------------------------------------------
The following example shows two options for linking SQL queries to create a
master/detail relationship.
In this example, we are using Delphi's DBDemos data to create a
Customer/Order relationship. Thus we wish to link the Orders detail to the
Customer master.
I. Delphi Query Linking
------------------------
a. Set the detail TQuery.DataSource property to point to the master
query's TDataSource component.
b. In the SQL "Where" clause for the detail query use a ':' followed by
the linking field name from the master:
example
select *
from orders
where orders.CustNo = :CustNo
Now each time the master record position changes, the detail query will
automatically be refreshed with the correct result set.
II. RB DataPipeline Linking
-----------------------------
a. Set the detail DataPipeline.MasterDataPipeline to point to the master
DataPipeline.
b. Use the detail DataPipeline.MasterFieldLinks property to define the
linking relationship
c. In the SQL for the detail, retrieve all records and sort them by the
linking master field:
select *
from Orders
order by CustNo
Notes:
1. Using RB DataPipeline, each query is executed only a single time - thus
performance is much faster.
2. RB Professional and Enterprise Editions include a visual Data environment
for creating SQL queries, defining linking relationships, and creating
Ask-At-Runtime parameters. Using the RB tools you could create the above
linked queries in about 10 seconds.
--
Tech Support mailto:support@digital-metaphors.com
Digital Metaphors http://www.digital-metaphors.com
--
Nard Moseley
Digital Metaphors Corporation
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Tried the filtering on the RecordPositionChange event for the pipline and it
work fine.
However will try the SQL Query aswel.
Thanks for the help
George