JIT pipeline - Where to set RecordCount?
I have several reports attached to Jit pipelines.
Currently, I set JitPipeline RecordCount in JitPipeline OnOpenDataset event. Logical I think.
But I have just found it does not work for the secord & subsequent reports, because Jit
pipeline does not get closed when first report is completed, so thereafter JIT pipeline
remains open and OnOpenDataset never gets fired. So all subsequent reports use
recordcount of first report.
Which event of the JIT pipeline should I use to correctly set the JitPipeline RecordCount?
(Because of the way my application is structured, with a common report selection dialog,
it is much better for me to use an event of the JitPipeline and not an event of TppReport for this).
Many thanks,
Edward Benson.
Currently, I set JitPipeline RecordCount in JitPipeline OnOpenDataset event. Logical I think.
But I have just found it does not work for the secord & subsequent reports, because Jit
pipeline does not get closed when first report is completed, so thereafter JIT pipeline
remains open and OnOpenDataset never gets fired. So all subsequent reports use
recordcount of first report.
Which event of the JIT pipeline should I use to correctly set the JitPipeline RecordCount?
(Because of the way my application is structured, with a common report selection dialog,
it is much better for me to use an event of the JitPipeline and not an event of TppReport for this).
Many thanks,
Edward Benson.
This discussion has been closed.
Comments
You should set the record count for all pipelines prior to calling
report.Print.
For master/detail reports you need to use DataPipeline.MasterDataPipeline
and MasterFieldLink properties to define linking relationships. The detail
datasets should include all data and should be sorted on the linking fields.
For an example see RBuilder\Demos\Reports\Demo.dpr. Run the project and
select the 'no database' section.
Below are 2 tech tip articles related to master/detail JITPipelines.
----------------------------------------------------
Tech Tip: Use Master/Detail JITPipelines
----------------------------------------------------
To use Master/Detail relationship with the JITPipeline:
1. Check out the demo dm0139 in the main demo reports app
for an example.
2. Make sure you have the Detail JITPipeline.MasterFieldLinks
defined to specify the relationship. In dm0139 the detailed it
linked to the master using the CustNo field from each pipeline.
3. Once you have things setup like the above, then you will need
to connect the Report.DataPipeline property to the master JITPipeline
and the SubReport.DataPipeline property to the detail JITPipeline.
4. In the FormCreate event set each JITPipeline.RecordCount
property to the total number of records for each.
You should not need to reset anything.
6. ReportBuilder expects the data in the detail dataset
to be in sorted order of the field links.
In dm0139, the linked field is the CustNo, therefore
the detail data must be order like this:
CustNo OrderNo
------ -------
1 001
1 002
1 003
2 010
2 009
2 005
----------------------------------------------------
Tech Tip: Using a JITPipeilne to Display Sorted Data
----------------------------------------------------
Question
--------
I am using JITpipeline and I want to know is there a way
to sort the data?
Solution
--------
You can implement this functionality by creating an
index for your data.
A simple index can be made using a StringList. You can
iterate through your data and for each row add an entry
to the stringlist. Each entry will contain the string
value to sort and the row index.
myIndex := TStringList.Create;
for liRow := 0 to RowCount-1 do
myIndex.AddObject(StringValueToSort, TObject(liRow));
Once you load the data, then you can sort the StringList:
myIndex.Sort;
Now you have an index in which each item in
the stringlist contains a pointer to the correct row.
To get the data for the first row:
liRowIndex := Integer(myIndex.Object[0]);
--
Tech Support mailto:support@digital-metaphors.com
Digital Metaphors http://www.digital-metaphors.com
--
Tech Support mailto:support@digital-metaphors.com
Digital Metaphors http://www.digital-metaphors.com
--
Nard Moseley
Digital Metaphors
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com