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

Open DataView programmatically ?

edited January 2005 in End User
Hi guys,

I've got report with autosearch field and this field should be
pre-calculated automatically. I've got Stored procedure which calculates
value for autosearch field. I have created two dataviews(one for report and
one for retrieval of calculated value for autosearch field like this: Select
ValueForASF from MySP).
In RAP code editor on ReportBeforeAutoSearchDialogCreate event I want to
open my second DataView to retrieve this value. Is it possible at all?

Thanks,
Dmitry

P.S. I'm using end-user solution with reports kept in DB.

Comments

  • edited January 2005
    Found solution :)
    Just created pass-through function like this:

    TOpenDataView = class (TtpFunction)
    public
    procedure ExecuteFunction(aParams: TraParamList); override;
    class function GetSignature: String; override;
    class function HasParams: Boolean; override;
    end;
    procedure TOpenDataView.ExecuteFunction(aParams: TraParamList);
    var
    lDataModule: TdaDataModule;
    lDataView: TdaDataView;
    lReport:TppReport;
    lDataViewName:string;
    tObj:TppCommunicator;
    begin

    //inherited ExecuteFunction(aParams);
    GetParamValue(0, lReport);
    GetParamValue(1, lDataViewName);

    {get the datamodule}
    lDataModule := daGetDataModule(lReport.MainReport);

    if (lDataModule <> nil) then
    begin
    // RB adds 'Query_' to object's name
    tObj:=lDataModule.FindUserObject('Query_'+lDataViewName);
    if (tObj <> nil) and (tObj is TdaQueryDataView)
    then begin
    //SHowMessage('Found Pipeline Object');
    if TdaQueryDataView(tObj).Active then
    TdaQueryDataView(tObj).Active := False;
    TdaQueryDataView(tObj).Active := true;
    end
    else begin
    ShowMessage('Could not find DataView Object '+lDataViewName+#10#13+
    'Please make sure it''s name matches with one appeared
    in Data Workspace');
    end;

    end;

    end;

    class function TOpenDataView.GetSignature: String;
    begin
    result := 'procedure OpenDataView(aReport:TppReport; const
    aDataViewName:string);';
    end;

    class function TOpenDataView.HasParams: Boolean;
    begin
    Result := True;
    end;

    Cheers,
    Dmitry

This discussion has been closed.