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

Need to set the TppDbText component's DataPipeline property manaully

edited July 2004 in General
Hello,

Launching a simple report that at design time displays fine, does not
display the data at runtime. In fact when re-opening the template at design
time, the TppDbText components are disconnected from the datapipeline as
well. I hook them up again and save the template, delete the TppReport from
the form and execute the report using private variables at runtime. (that is
because I had problems with the TppReport component holding onto the
template name with SaveAsTemplate = FALSE, different thread ...)

The result is the data does not display. I have to use the loop (below) to
set that property to get that report to display the data. Why the
disconnnect is happening is the mystery.

procedure TfrmReports.ExecutePricingPlanReport;
var
I : Integer;
begin
try

try
DM.tblPricingSnapShot.Close;
FReportRuntime.Reset;
tblPricingSnapshot.Close;
dsRuntime.DataSet := tblPricingSnapshot;
dbpRuntime.DataSource := dsRuntime;
FReportRuntime.Template.Filename := '';
FReportRuntime.Template.Filename := 'Reports\' +
C_RPTTEMPLATE_PRICINGSNPSHOT;
FReportRuntime.Template.LoadFromFile;
tblPricingSnapshot.Open;
FReportRuntime.DataPipeline := dbpRuntime;

for I := 0 to ComponentCount - 1 do
if (Components[I] is TppDBText) then
TppDBText(Components[I]).DataPipeline := dbpRuntime;



FReportRuntime.Print;

except
on E:Exception do
begin
....
end;
end;
finally
Screen.Cursor := crDefault;
end;
end;


Again, why do I need to "re-connect" those TppDBText components to get the
data to display?

over and out.


Thanks

Comments

  • edited July 2004
    Hi Reid,

    There are no known issues like this one in ReportBuilder. The datapipeline
    name will be stored down when you save your template and then when you load
    the template, it will first look for that datapipeline on the main form and
    then on the datamodule, if you have one. the only reason the data would be
    disconnected is that ReportBuilder cannot find the datapipeline. Are you by
    chance creating this datapipeline dynamically? If so, you need to be sure
    you create it before the report is created and that the owner is the same as
    the report. If you still cannot get this working, please send a small
    example demonstrating this behavior in .zip format to
    support@digital-metaphors.com and I'll take a look at it for you.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2004
    Hi Nico

    datapipeline
    load
    and
    be
    by
    as


    In this case the form has a TppDBPipeline component and a TDatasource
    component. The datasets and TppReport component are created at runtime.
    The name of the TppDBPipeline component never changes, from the time the
    report was created at design time using the same TppDBPipeline component up
    until the time the report executes.

    So if you are stating that the component creation order is paramount and
    can't be violated then ok, that is the case here I suspect. The private
    TppReport member is being created in the TForm's OnCreate() handler and
    "SELF" is being passed to the constructor. So at that point it should be
    right, both have the same parent.

    FReportRuntime := TppReport.Create(Self);
    FReportRuntime.DataPipeline := dbpRuntime;


    The example "zipped up" is not practical for me. The app is client/server,
    and the actual report this is happening on is sourced from a flat file using
    a TVolgaTable component, I am not sure if your organization owns that tool.
    And recreating it using a TTable, filling it with the values, etc is well..
    Too much work.


    Disclaimer :
    I am a bit dismayed now that I seem to have to constantly employ so many
    work arounds with something as simple as setting a template name, hooking up
    the TDatasource, Pipeline, and dataset and launching it. And I am talking a
    simple one record report. Considering this is "ground zero" of your product,
    I wonder how working with the server part of the software is going to go.
    :@)
  • edited July 2004
    Hi Reid,

    If the datapipeline is on the form, then the creation order should not
    matter. I mentioned it to ensure the datapipeline was infact available when
    the template was loaded.

    I understand you are frustrated, but please understand that without an
    example of this behavior I can see and run, I have very little chance of
    finding the problem. You mentioned in some of your prior posts that you are
    tying to perform a simple task on a simple report. If this is the case,
    then it should not be too much trouble to create a separate simple example
    that recreates this behavior. I feel that if you spend the time to create
    us an example (separate of your main app), we can get to the bottom of this
    problem quicker and easier.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2004

    when
    are
    this


    Hi Nico,

    I know your frustration too, if you can't reproduce it effieciently you
    can't fix it, I have clients too.

    But again, the conditions here are fundamental.

    1) Tform has a static Datapipeline and Datasource hooked up to each other.
    2) Using that same form , at runtime you create the TppReport Component.
    3) You assign what you need and launch the report.


    procedure TfrmReports.FormCreate(Sender: TObject);
    begin
    FReportRuntime := TppReport.Create(Self);
    FReportRuntime.DataPipeline := dbpRuntime;
    end;


    procedure TfrmReports.ExecutePricingPlanReport;
    var
    I : Integer;
    begin

    try
    FReportRuntime.Reset;
    tblPricingSnapshot.Close; << Flat file, TVolga table, always contains
    data, always.
    dsRuntime.DataSet := tblPricingSnapshot; <<- Datasource is
    assigned the dataset
    dbpRuntime.DataSource := dsRuntime; << Give the datapipeline the
    dataset
    FReportRuntime.Template.Filename := 'Reports\' +
    C_RPTTEMPLATE_PRICINGSNPSHOT;
    FReportRuntime.Template.LoadFromFile;
    tblPricingSnapshot.Open;
    FReportRuntime.DataPipeline := dbpRuntime;

    for I := 0 to ComponentCount - 1 do
    begin
    if (Components[I] is TppDBText) then
    begin
    TppDBText(Components[I]).DataPipeline := dbpRuntime;
    end;
    end;
    FReportRuntime.Print;
    except
    on E:Exception do
    begin
    frmMain.ShowDialog(E.Message, dtError, Self.Handle);
    end;
    end;

    Nico, I am not doing anything in event handlers or anything else at all.
    The code above is all there is. Without the for loop no data displays.

    I am not sure of your role there, if you own the company or are a developer,
    nor is it any of my business, I just feel that from a "business"
    perspective, it is not a big deal to have a response of "It is a known
    issue" if we are talking about an absctract application and not the
    mainstream.

    But if the response is too a simple equation above with one report showing
    one record from a table and it won't work without the for loop above to
    reset it, then the procedure that streams the state into the .rtm file
    should be reviewed, or something becuase that is most likely the culprit.
    In any respect it is a *serious* bug in my opinion.
  • edited July 2004
    Hi Reid,

    You code below looks pretty straight forward. Since you are loading this
    report from a template file, there is no need to assign the
    Report.DataPipeline. This value is saved in the template file. Also, I am
    a bit unclear why you are closing your dataset before loading the template
    then re-opening it. This does not seem to affect anything. I do not see
    why you are calling Report.Reset either. The only reason I can think of
    that your data is not showing up is that the datapipeline name saved in your
    template does not match the one on your form. You might try saving your
    template down as text and opening it in Notepad to be sure the names match
    up. I've been working with a simple example that more or less implements
    your code below and it seems to work correctly. If you would like to
    download this test application, you can do so by following the link below.

    When I say that an issue is not known in ReportBuilder, I am simply letting
    you know that out of the hundreds (most times thousands) of questions our
    support team answers per month, this issue has never come up. I will
    usually only say this when it is a "main stream" issue implying that it is
    probably not a bug. I did not mean to degrade the validity of your question
    by doing so. I apologize for the misunderstanding.

    http://www.digital-metaphors.com/tips/LoadTemplateTest.zip

    --
    Best Regards,

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