Open DataView programmatically ?
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.
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.
This discussion has been closed.
Comments
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