Posted By: CraigD OracleDataset.Variables Property Editor - 07/13/00 06:06 AM
I have an end user reporting application where I need to be able to let the user create SQL against an Oracle back end. It is important to be able to provide a mechanism whereby they can create variables and set their values at run-time.

Does anyone know how you go about calling the design-time property editor for the Variables property at run-time?
The variable property editor was not really designed with application end-users in mind, but this is how you can use it in your application:

To invoke the variable editor for a TOracleQuery instance, add the OracleVarEdit unit to the uses clause of the unit, and use the following code:
[quote]
Code
procedure TForm1.Button1Click(Sender: TObject);
begin
  ExecuteVariablesEditor(MyQuery);
end;
[/quote]
For a TOracleDataSet instance, this is a bit more complicated:
[quote]
Code
type
  TMyOracleDataSet = class(TOracleDataSet)
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ExecuteVariablesEditor(TMyOracleDataSet(OracleDataSet).InternalQuery);
end;
[/quote]
You need to access the InternalQuery (a TOracleQuery instance) to activate the Variables Editor, which is a protected function. By deriving your own TMyOracleDataSet, you can access the protected information.


------------------
Marco Kalter
Allround Automations
© Allround Automations forums