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

Two questions....

edited January 2002 in General
Hello,

I'm starting to look at the demos, but most I cannot run because I don't
have a lot of the database files that it uses (I don't think I installed
them Delphi). Looking at the code helps a lot though.

First question deals with soliciting date ranges for a report. I saw
something in the help file (I foget off the top of my head what it's called)
which seems like a lot of work for only needing a starting and ending date.
I've basically used the Params property of an IBQuery component instead. Is
there an easy way to use what's built into the report?

Second question: I'm not quite understanding how the query information is
persisted with the template file. When it's loaded into a TppRepor, does it
populate the pipeline upwards with the query information? Or do I need to
set the query for the IBQuery component, then load the report template?

I like the idea of storing the template outside the exe to reduce exe size,
but am a little confused at this point.

Thanks,

Lee


--


Didn't we go to different schools together?

Comments

  • edited January 2002
    The first thing I would do is run the Delphi installation program and
    install the Delphi example files. Almost all of the demos are based on these
    files...

    In dealing with the data access components the first question is: Are you
    using the Data workspace? (the 'Data' tab displayed in the Report Designer)
    If so, then defining date range search criteria is simply a matter of
    setting these up via the Query Designer.

    If you are not using the Data workspace, then you are probably placing data
    access components on a Delphi form or data module. This is fine, but in this
    case, the data access components are saved with the data module or form.
    Saving the report in a separate file is possible, but it doesn't do much for
    you, because the data and the report are effectively saved in two different
    places. In order to load the report and get it running again, you have to
    first instantiate the form or data module containing the data access
    components, create a report component inside one of these and then call
    LoadFromFile:

    procedure TForm1.Button1Click(Sender: TObject);
    var
    lDataModule: TDataModule;
    begin

    {create an instance of the data module which has the data access
    components}
    lDataModule := TDataModule1.Create(Self);

    {create a report component with the data module as the owner (very
    important)}
    lReport := TppReport.Create(lDataModule);

    lReport.Template.FileName := 'c:\my reports\reportdef.rtm';

    lReport.Template.LoadFromFile;

    lReport.ModalPreview := True;

    lReport.Print;

    lDataModule.Free;
    end;

    Because the data module and the report definition are acting here as a
    matched pair, there is little utility gained in separating them. This why
    many developers use the Data workspace to define the data, it makes the
    report definition far more portable.

    On the other hand, if you have well-organized reusable data modules, it may
    be practical to instantiate the one needed for a given report, so both
    approaches can work...

    Cheers,

    --
    -
    --
    Tom Ollar
    Digital Metaphors Corporation

    For more on this topic see the 'Deployment Options' section of the
    Developer's Guide.
  • edited January 2002
    Ok,

    So if I use the Data Workspace, do I still need to use the IBQuery,
    DataSource, Pipline components?, or do they get ixna'd?

    Thanks for you help,

    Lee


    --


    Didn't we go to different schools together?
  • edited January 2002
    I tried using the Data Workspance. I created a query (pasted one from
    IBQuery), changed all fields to use it and now when I preveiw the report it
    doesn't do anything. At least, it looks like it doesn't do anything. If I
    cancel after a while, it looks like it rendered a little bit, that that it.

    Any ideas?

    Thank you,

    Lee


    --


    Didn't we go to different schools together?
  • edited January 2002

    I set the the data properties in Data Work space for IB, BTW.

    Lee


    --


    Didn't we go to different schools together?
  • edited January 2002
    Da,

    I needed to reset the Report | Data... setting.


    Thanks,

    Lee


    --


    Didn't we go to different schools together?
  • edited January 2002
    I get a nasty error in RTL60.bpl now when I try to save my project.

    Lee


    --


    Didn't we go to different schools together?
  • edited January 2002
    Ok,

    Here is what I have now:

    As I mentioned, I swaped out the pipline for a query designed in the Data
    Workspace. I couldn't save because everytime I tried I got an AV in
    RTL60.bpl. So I saved the project to a file in the report designer and
    close the project without saving it.

    Now, I re-open the project, delete the original ppReport comp from the form
    and put a new one on it. I open the designer and load the previously saved
    report from file. Now, when I try to preview the report, I get a login
    prompt (which is set to false in the IBDatabase comp). So I look in the
    data properties and the IBDatabase comp doesn't show up any longer. When I
    drop down the combo, there is nothing to choose from. So I open the
    database containing the IBDatabase comp and check to see if connected =
    true. It is. So I re-open the designer, go to data tab and check the data
    properties where I see that the IBDatabase Component is now showing. Now, I
    can preview the report (last page takes so long to render that I have to hit
    cancel).

    When I try to save the project now, I still get AV in RTL60 error message
    and back to square one.

    Any ideas?

    Lee




    --


    Didn't we go to different schools together?
  • edited January 2002
    To use DADE, you will want look at our EndUser example projects.
    Essentially, the dataaccess components you used to have on a form, are now
    created entirely in the data workspace as a single Dataview.

    If you are getting an error in RTL60.bpl, then try using the report designer
    at runtime. I get this error every now and then, but it is never
    consistently repeatable on our machines here. I suspect is has to do with
    editing of the SQL text. We'll have to do some more tests with IB at Delphi
    design time.

    The database settings are stored in the C:\Windows\RBuilder.ini file. So,
    you'll want to make changes to the settings (so they are correct) in the
    data workspace before you create a query in the data workspace.


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.