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

A question on timing with data preparation

edited April 2006 in General
Hi there:

I am using DBISAM in a project for my client which makes heavy use of the RB
environment for reporting. DBISAM does not provide for views in the sense
that (for example) MS SQL, Access or ORACLE might. I need to make a fairly
complicated set of SQL joins in a script which runs using an ExecSQL
statement and creates/updates several tables on the fly. Following this I
can then run the report which assumes the presence and population of these
tables.

I therefore run this script in the application code prior to calling the
templated report and this is OK; however on a subsequent call to the
application method I get a DBISAM error telling me that the table is still
in use even though the report has been closed and the original script has
long been run.

I would therefore like to be able to run this query from within the
reporting environment so that the data is forst created then the report
template is loaded and the report can be previewed, printed and archived.

Is there a point in time where I can call back on the SQL script which runs
this from within the reporting environment - a sort of OnBeforeDataCreation
event? here is the basic pseudocode

Begin
Create DBISAMQuery;
try
Load SQL from external table; // complicated set of joins and table
creation
ExecSQL; // this creates and populates the tables required by the report
template
finally
Free DBISAMQuery;
end;
LoadTemplateName;
PrintReport;
end;

DBISAM can also create in-memory tables. Is there any way in which I can
direct the DADE data module in the report explorer to access these in-memory
tables instead of physical ones since they are in all other aspects exactly
the same?

Please let me know if there is any more expanded information I can supply -
thanks in advance for any help,

David Mustard

Comments

  • edited April 2006
    Sorry. Why do I always forget to mention the most important point! :=))

    RB Enterprise version 10.2 and I have the DBISAM DADE plug-in working fine
    under the latest version of DBISAM (4.23) all under Delphi 2006.

  • edited April 2006

    - you can use the Report.OnInitializeParameters and
    Report.BeforeOpenDataPipelines events to create/initialize parameters, and
    to prepare data, modify SQL, etc.

    - After you run the report try calling.

    myReport.Print;

    myReport.Template.New; // clear the layout
    myRport.FreeModules; // free the datamodule and code module

    - You can use TdaSQLBuilder to modify the sql assoicated with a dataview.
    See TdaSQLBuilder in the RBuilder.hlp

    - Another option is to create a custom dataview class. For an example, see
    RBuilder\Demos\EndUser\Custom Dataviews.




    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2006
    Thanks Nard,

    I have also been experimenting with the creation of a custom data view class
    template on the query to see if that coughs up something useful for the
    future (based on your daADOTemplateDataView examples which I found lurking
    in the newsgroup).

    This way I can hopefully create a daDBISAMTemplateDataView unit from which I
    can create a set of template views and see if these help. The advantage
    being that the contents of these views are less likely to be creatively
    intercepted by the user but will give them the chance to create a report
    from the data without worrying about how it is made up. On top of that it
    reduces the need to create pass-through code which I'm trying to avoid.

    It's slow work but the first run went OK although it reported a stack
    overflow error so I need to go over the code carefully and see what I've
    forgotten to address. If it all works after general tweaking and so on
    maybe it might be something which other DBISAM users can make use of?

    cheers - David.

  • edited April 2006


    Yes. Please email any examples to support@digital-metaphors.com and we can
    make them available to other DBISAM users. :)

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.