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

Event for dataview or particular report

edited November 2001 in General
Is it possible to associate an event with the running of either a
particular dataview, or even a single report?

The idea being that whenever a single report, (or any reports based on
the same query) are run, a process is kicked-off that performs some
calculations on the data-and ensures the accuracy of the report.

I don't want the event to run before every report since it can be time
consuming. Preferrably, the event is "visible" during end-user design
time.

Any ideas, as to best do this?

Thanks in advance!

John

Comments

  • edited November 2001
    Use the Report.BeforePrint event. You have to give us some more info for
    the specific criteria for when you want to perform this operation. You
    could search for dataviews by name (Dataview.Description is what you see at
    the top of the dataview in the DADE workspace, though it usually pulls the
    name from the datapipeline's UserName property). You can also look at the
    datapipelines as well if you want. You could also pull the TdaSQL object
    (Dataview.SQL property)from the dataview to parse the generated SQL for some
    further validation of what the query is going to return.


    procedure TForm1.ppReport1BeforePrint(Sender: TObject);
    var
    lDataModule: TdaDataModule;
    liIndex: Integer;
    lDataView: TdaQueryDataview;
    lDataPipeline: TppDBPipeline;
    begin

    {get the datamodule}
    lDataModule := daGetDataModule(ppReport1);

    if (lDataModule <> nil) then
    begin

    for liIndex := 0 to lDataModule.DataViewCount - 1 do
    begin
    lDataView := TdaQueryDataView(lDataModule.DataViews[liIndex]);

    if (lDataView <> nil) and (lDataView is TdaQueryDataView) then
    begin
    {only custom dataviews can have multiple data pipelines}
    lDataPipeline := TppDBPipeline(lDataView.DataPipelines[0]);

    ShowMessage(lDataPipeline.Name);

    ShowMessage(lDataView.Description);
    end;

    end;

    end;

    end;

    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited November 2001
    Jim,

    Wow, thanks for the info...You've given me several good options.

    John

  • edited November 2001
    I should have also added, that DADE validates the sql so that it is
    syntactically correct (ie. submits the sql to the server for the validation)
    for the database server when the dataview is built by the end user.


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.