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

Issue on Template Loading

edited November 2003 in General
Hello,

I am sorry for bothering you with this very specific problem. But I?ve
been trying to solve it for a long time, unsuccefully.
First of all I want to appologize for my English, it is not my native
language.
The scenario descriptions are here for you to understand the reason for
some of our decisions, and to show you that some of the short ways for
solving our issue are not applicable.

The Technical Scenario:
-OS: Windows 2000 Professional
-Delphi: Version 6 with Update Pack version 2
-Report Builder: Version 6.0

The Business Scenario:
Our company was contracted by another company (both of them are
software-houses) without ReportBuilder or even Delphi Know-How.
The contract implies that we would develop a software for them, and after
this project have been finished, the maintenance of the system will be done
by this company.
This software is a new version of an old MS-Access version and, as you
could imagine, is beeing written in Delphi.
Today there are over 300 consumers using the MSA version.
The software is the same for all the consumers, but the reports are not.
Each and every customer need one or more reports to be different than the
reports specified in the original program.

The solution proposed:
As we will not be responsible for the maintenace of the system, and our
contracting party does not have know-how to use Delphi, we decided to use
the following architecture for the software:
1) We will develop the main software with all the reports needed.
2) We will develop a Report Generator, based on your End User Demos, for
our contracting party to design new reports to substitute the reports
defined in the main project (They will replace only the layout). These new
report templates will be stored in the database.
3) At the moment of execution of the report, the software (main one)
should find out if there is a template in the DB and, if so, should
substitute the original by the DB one.

The problem:
When I execute (print) the report without modified template, it?s OK. But
when I put a template in de DB, it don?t work fine.
The name of the pipelines in the DataModule is exacly the same as in the
template (that was set in the Report Generator).
The DataPipeline?s name in the DataModule is exacly the same as in the
template (also set in the Report Generator).
The code for loading the template from the DB is as follows:

01: var
02: stream: TMemoryStream;
03:
04: begin
05: ClientDataSet.Close;
06: ClientDataSet.Params.ParamByName('ID').Value := PID;
07: stream := TMemoryStream.Create;
08: try
09: if getTemplateByName(ClassName, stream) then
10: Report.Template. LoadFromStream(stream);
11: Report.Print;
12: ClientDataSet.Close;
13: finally
14: FreeAndNil(stream);
15: end;
16: end;

As you should imagine, the method getTemplateByName gets a template stored
in the DB and saves it in the stream variable. The ClientDataSet is a
TClientDataSet in wich the Pipeline is connected to, and I need it to be the
dataPipeline for the report because it may be parametrized.
Right after the line 10, the property Report.DataPipeline.Name have the
value: 'Pipeline1'. Its report.dataPipeline.owner.className is:
'TdaSQLQueryDataView'.
I have tryied to assign the Pipeline as the DataPipeline for the Report,
but the result was the same. I have tryied to replace the SQL sentence for
the new dataSet connected to the reports DataPipeline. None of them have
worked.
Is there any way for me to load only the layout from a report, keeping the
data retrieving for the components that are already connected to the report
component? How can I do that?

Thank you very much in advance.

Ricardo Acras
Object Solutions
Curitiba - Paran? - Brazil

Comments

  • edited November 2003
    Hi Ricardo,

    It looks as though the templates you are loading were accessing data using
    DADE when they were created. All DADE information is saved down in the
    template so even though you are connecting your report component to the
    datapipeline on your form, the template information will override this. To
    work around this issue, you have three options...

    1. Recreate all your templates with the new connectivity and replace the
    current templates in your database.

    2. Start using the DADE connectivity with the DataSnap/Midas plugin for
    ReportBuilder. An EndUser demo of this can be downloaded by following the
    link below.
    http://www.digital-metaphors.com/tips/RBEndUserWithDataSnap.zip

    3. Edit the templates as text and take all DADE connectivity out of the
    file, then save back to the database. If you would like to try this method,
    check out the following demo on editing the template as text.
    http://www.digital-metaphors.com/tips/EditTemplatesAsText.zip

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2003
    I am sorry for the wrong date of my posting.
    I just realized that my computer?s date is out of date. :-)
    Can I fix it? If so, how?

    tnx
    acras


This discussion has been closed.