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

How can I emulate an empty report for a quick preview with no data (just a place holder)?

edited September 2002 in End User
Hallo NG,

My environment: RB 5.5, DADE, RAP, Delphi 5.

I have implemented a "quick preview" feature in my reporting application,
which just displays the first page of a report (no page switch available)
and no auto search dialog being shown. I want just to show the report's
layout here.

Surely, the data selection parameters set in the DADE remain in force for
the SQL queries this way.

Sometimes the reports contain nested subreports and I cannot make sure, the
appropriate master data is available to show all detail subreports right
within the first page I display only.

My question: Is it possible to emulate an empty report with no data being
shown at all, so that all detail subreports could be shown too. I need to
show just a kind of template like it looks in the designer, maybe with place
holders instead of data.


Thanks!

Best regards

Leo Kaploun

Comments

  • edited September 2002
    Dynamically add criteria values to the dataviews so that you only get enough
    data for the first page. This way DADE won't fire a query that gets all the
    details for all the masters that could print in the full report. There is an
    example of setting criteria values on an end user report without showing the
    autosearch dialog in
    RBuilder\Demos\Autosearch\6.SetEndUserSearchCriteriaInCode You can alos
    choose to skip using the autosearch feature and modify the criteria objects
    on the dataview by extracting the dataview's SQL object and setting the
    value on a non-autosearch criteria. Here is an example that extracts the
    TdaSQL object and modifies its properties:
    http://www.digital-metaphors.com/tips/ExtractSQLObject.zip


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited September 2002
    Hallo Jim,

    thanks for the quick reply, but I think your advice to set another sql where
    clause would not work this way. I want to offer a common solution for every
    report could have been made by an end user. I cannot not know, what data is
    being reported, thus I cannot change the sql parameters to restrict the data
    got. Technically, I know exactly how that is done.

    My idea is rather not to show actual data, but to restrict the sql execution
    time to a minimum.

    I have tried to change the where clause by adding "and 'c' <> 'c'" as you do
    to get just an empty data structure. Unfortunately I have found, that
    judging by the quering time, the paradox's sql engine goes through all the
    records checking the "where" condition on every one.

    It seems to me, the only way to do what I want would be to disallow the
    Datapipelines to pull data at all. Is it possible? Setting the RangeBegin,
    RangeEnd or RangeEndCount does not help, because the data is queries anyway
    before the traversal starts.

    Thanks for any further hint!


    Best regards
    Leo Kaploun


  • edited September 2002
    The datapipeline asks the dataset for records. It is up to the database that
    you are using to determine how fast it can retrieve the dataset. Have you
    tried creating a simple TTable with a filter on it that eliminates all but
    one record. Connect it up to the datapipeline by default in order to preview
    an empty report. When you print, you can connect the pipeline's datasource
    up to the full query to get all of the records. Swapping out the dataset or
    filtering the dataset is the way that you can limit the data that is
    retrieved. Setting properties on the pipeline won't affect the size of the
    dataset, it only affects how the dataset is traversed.


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited October 2002
    Hallo Jim,

    sorry I may be getting you nervous, but I think I cannot connect any
    datapipeline to a certain datasource (as table or a query) since it is up to
    my programn user, which database he is running my program on. I do not know
    which tables the user has invoked into the DADE's dataviews. The DADE
    generates the SQL queries on the fly depending of the Datamodule's
    TdaDataview's TppDBPipelilnes' settings. That is why I just cannot set the
    Database to a table that should then have the same structure as the Pipeline
    set to it. There may be no such table available on the user's side.

    Or maybe you mean, I should create one on the fly using the daTable
    definitions in the datamodule and then kill it again?

    My idea would be to make the sqls generated on the fly do nothing, but I did
    not cope with changing the SQL text, because the datapipeline resynchronises
    it over again and thus overrides my text.

    Any idea is greatly appreciated!

    Best regards
    Leo Kaploun [GS]


  • edited October 2002
    There is an easier way. How about set the PageLimit property on the report
    to 1 or 0. Toggle this depending on which device the report is generating
    for. You could add a menu option in the designer menu that lets the user
    control whether or not to limit the page output for the screen. Then when
    the user chooses to print to file or printer, it would print all the records
    in the dataset. To only print all pages if you are printing to the printer,
    use the Report.BeforePrint event like this:

    procedure TForm1.ppReport1BeforePrint(Sender: TObject);
    begin

    if (ppReport1.PrinterDevice = nil) then
    ppReport1.PageLimit := 1
    else
    ppReport1.PageLimit := 0;

    end;


    Here is an example of merging the designer's menu to add a menu item:
    http://www.digital-metaphors.com/tips/MergeMenuWithDesigner.zip


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited October 2002
    Thanks Jim,

    but that was the first thing I have done. ))

    Setting the page limit actually dramatically reduces the report GENERATING
    time, but not the QUERING time.
    I need a solution to make the pipelines.datasets get less records, or even
    better none...

    --
    Mit freundlichen Gr??en

    Leo Kaploun [GS]


  • edited October 2002
    You can set the property Datapipeline.OpenDatasource = false. Then when you
    want to print the report with data, you can activate the query yourself in
    code to get data.


    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.