Subreports disappear.
Hi!
I have problem with D5Pro and RB7Pro in case subreports don't have records.
My report setup is like this:
Main report's detail band contains an region with few labels, DBText and
DBMemo components (some of them are inside ohter "child" regions) and
two subreports of pbChild type. First subreport is set to be
ShiftRelativeTo to main region and second one is relative to first. All
reports are linked to different TppJITPipeline components.
I update subreports' RecordCount in main pipeline's
OnRecordPositionChange event.
The problem is, that in case of empty subreport(s) entire report is
messed up. For examle if main pipeline has 4 records and subreports
should have record count like:
first : 2,1,0,0
secont: 1,0,0,1
then what I see is:
RecNo MainRep Sub1 Sub2
0 yes 2 no
1 yes 1 no
2 no no no
3 no no no
So subreport 2 is missing always and after first subreport with rec
count 0 nothing prints. Hovewer if I add 5th record where both
subreports have rec count 1 then what I get is
RecNo MainRep Sub1 Sub2
0 yes 2 1
1 yes 1 no
2 no no no
3 no no no
4 yes 1 1
So first two and last record are OK while 2 and 3 still missing. Any
idea how to fix this?
PS. Just before posting I tested case where I added code like
SubRep1.Visible:= Pipeline1.RecordCount > 0;
SubRep2.Visible:= Pipeline2.RecordCount > 0;
into OnRecordPositionChange event and now only record 2 is missing.
Still, I feel it should work without these lines too.
TIA
ain
I have problem with D5Pro and RB7Pro in case subreports don't have records.
My report setup is like this:
Main report's detail band contains an region with few labels, DBText and
DBMemo components (some of them are inside ohter "child" regions) and
two subreports of pbChild type. First subreport is set to be
ShiftRelativeTo to main region and second one is relative to first. All
reports are linked to different TppJITPipeline components.
I update subreports' RecordCount in main pipeline's
OnRecordPositionChange event.
The problem is, that in case of empty subreport(s) entire report is
messed up. For examle if main pipeline has 4 records and subreports
should have record count like:
first : 2,1,0,0
secont: 1,0,0,1
then what I see is:
RecNo MainRep Sub1 Sub2
0 yes 2 no
1 yes 1 no
2 no no no
3 no no no
So subreport 2 is missing always and after first subreport with rec
count 0 nothing prints. Hovewer if I add 5th record where both
subreports have rec count 1 then what I get is
RecNo MainRep Sub1 Sub2
0 yes 2 1
1 yes 1 no
2 no no no
3 no no no
4 yes 1 1
So first two and last record are OK while 2 and 3 still missing. Any
idea how to fix this?
PS. Just before posting I tested case where I added code like
SubRep1.Visible:= Pipeline1.RecordCount > 0;
SubRep2.Visible:= Pipeline2.RecordCount > 0;
into OnRecordPositionChange event and now only record 2 is missing.
Still, I feel it should work without these lines too.
TIA
ain
This discussion has been closed.
Comments
controls whether or not the main report prints a record when there is no
detail data to print. Set this property set to False on your detail
datapipelines.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
it seems to work correctly. Here is a template that connects to DBDemos
that is configured in the way I think you have your report configured for
this case. Download it and see if you can configure this report to show the
problem. Email the changed template that shows the problem to
support@digital-metaphors.com
http://www.digital-metaphors.com/tips/SecondSubreportDoesNotPrint.zip
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
data pipe changes record positions, in your attempt to create a master
detail relationship. You can create a master detail relationship with a JIT
pipeline as shown by in our main report demo #139.
If your report is a one pass report, then the subreports will not disappear.
So, the problem is in the second pass. Since your JIT pipelines are not
master detail data pipelines, they aren't getting reset for the second pass.
You can call their Close methods in the main report's OnEndFirstPass event
and it will begin working correctly because the report will open them to
start the second pass through the data. The other alternative is to use the
mater detail functionality as shown in the demo #139.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
believe that you need to build the JIT pipelines so that the master detail
relationship is like that of the demo. The JIT pipeline record count should
include the total number of detail records for the entire report and that
the MasterDataPipeline and MasterFieldLinks properties determine the master
records for which the details belong.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
remove the field links on the data pipelines and create the dataset
differently by creating grouped data in a single JITPipeline. The master
detail linking requires that the total number of detail records be known
beforehand so that it can propertly traverse through them as a single
dataset. Your single JIT report is going to be simliar to one using a
joined dataset from a SQL query. This way you can create the records and
control the breaks by setting the group break value.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
and retrieve the master and detail data and place it in memory datasets for
the currently selected report. You really should tie a pipeline to a report
or report template. The pipeline needs to have its field object created
based on the dataset. How are you handling field creation for the different
datafields on the JIT? If you have a large selection of reports on a form
or report templates that you load, it might make sense to locate them in
different TDatamodules.
An alternative to this is to build the memory datasets and the pipelines all
on the fly based on the report's data access structure information which is
stored in a database table. Surf Torry's Delphi pages for some memory
dataset components that are popular. Then you can link the datasets
together in a master detail relationship for your report. The reason for
using memory datasets is mainly that your JITPipeline calculates the detail
records, or gets them from some data sturcture, which probably takes time.
If the report is to be run multiple times, then this is not optimized.
Placing the data in a memory dataset will make subsequent data access times
much faster than having to rebuild it in the JITPipeline everytime.
Or, make one pass through the data and calculate the master record count and
the detail record count so that you can continue to use the JITPipeline.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
problem. You are right, you don't have to, especially if you are using a
JITPipeline. It may be simpler in your case to build the data access
generically using RTTI to get the field names from your objects.
Yes, the JIT events should have been created with Sender parameter. Here is
an example which does this. We can't change the JITPipeline to support it,
because it would break too many (every) currently distributed reports.
http://www.digital-metaphors.com/tips/JitWithSenderInevents.zip
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com