Home Datapipelines
New Blog Posts: Merging Reports - Part 1 and Part 2

Setting JITPipeline.Name breaks iteration

edited December 2009 in Datapipelines
Hi,

I am using a evaluation version of ReportBuilder 11 under Delphi 2010. I am
close to complete understanding on how to use ReportBuilder, except for one
small strange behavior.

I have the following function to create a JITPipeline on the fly:

0: function AddPipeline( sAName, sAFriendlyname : String;
oAOnGetValuesEvent : TppGetFieldValueEvent; iARecordCount : Integer ) :
TppJITPipeline;
1: begin
2: Result := TppJITPipeline.Create( Self );
3: Result.Name := sAName;
4: Result.UserName := sAFriendlyname;
5: Result.OnGetFieldValue :=oAOnGetValuesEvent;
6: Result.RecordCount := iARecordCount;
7: end;

This works perfectly: I can add fields, links and everything and get the
reports I want.

But...

But when I DO set the name of a pipeline (enable line 3)
- I get a wrong report with the an endless amount of records, RecordIndex
sticks to 0

When I DON'T set the name of a pipeline (disable line 3):
- I get the right report with the right amount of records (recordcount),
it works beautifully.
- But when I open a saved template, all my DBText-fields have forgotten
want pipeline they were using: I have to manually assign pipelines to all
the DBText-fields every time.


I'm hoping someone can help me with this small weird behavior and tell me
what I'm doing wrong.


Regards,

Leslie

Comments

  • edited December 2009
    Hi Leslie,

    Thank you for your interest in ReportBuilder.

    When you build a report, all the data aware components are given a pipeline
    name from which they will retrieve data. Since you are creating a pipeline
    on the fly in code, you will need to be sure that all components inside the
    report, and the report itself are assigned to that pipeline. Otherwise the
    pipeline they are assigned to will be incorrect.

    I believe when you are not setting the Name property, a default name is
    given which coincidentally matches up with the components on your report
    (giving you the correct output).

    Once you create the pipeline, be sure to assign it to the
    Report.DataPipeline property, then loop through each report component and
    assign the pipeline property of each data aware component. Take a look at
    the following article on how to create a report object loop.

    http://www.digital-metaphors.com:8080/Delphi_Code/Layouts/Report_Object_Loop

    Note: Rather than check the HasFont result, try using IsDataAware, then
    assigning the DataPipeline property...

    begin

    for liBand := 0 to aReport.BandCount-1 do

    for liObject := 0 to aReport.Bands[liBand].ObjectCount-1 do
    begin
    lObject := aReport.Bands[liBand].Objects[liObject];

    if lObject.IsDataAware then
    lObject.DataPipeline := MyDataPipeline;

    end;

    end;

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.