Re: Passing parameters to TraProgram in Delphi
Here is my application structure:
MAIN APPLICATION *
|
==> Database (Paradox / SQLServer) **
|
|
==> Report templates ***
* : I have RAP custom functions defined in the main application.
** : The report SQL statements, the reports parameters definitions are
stored in the database.
*** : Due to performances issues on a few reports, I had to replace RAP
event-handler by Delphi event-handler (it's supposed to be faster) and put
these reports in dynamically-loaded runtime packages. It gives me the
modularity I needed for my application.
In run-time, I can access my RAP custom functions in the RAP Calc Editor,
but not directly in Delphi editor. Example :
In my reports, I have "built-in WHERE", which contains hard-coded WHERE
conditions that must absolutely be passed in the SQL statement. I also have
a function for Parameters Mappings, which contain the mappings between
TppParameters and database fields. These functions didn't have any
parameters, so it worked perfectly.
===============================
raBuiltInWHERE := Report.CodeModule.FindGlobalProgram('BuiltInWHERE');
if raBuiltInWHERE <> nil then
begin
strSQLStatement := strSQLStatement + strWHERE +
raBuiltInWHERE.Execute.AsString;
end;
===============================
My problem is that I have some functions that need to be called from Delphi
and I must be able to pass parameters to that function. I hope my
explanations are clear enough.
David
MAIN APPLICATION *
|
==> Database (Paradox / SQLServer) **
|
|
==> Report templates ***
* : I have RAP custom functions defined in the main application.
** : The report SQL statements, the reports parameters definitions are
stored in the database.
*** : Due to performances issues on a few reports, I had to replace RAP
event-handler by Delphi event-handler (it's supposed to be faster) and put
these reports in dynamically-loaded runtime packages. It gives me the
modularity I needed for my application.
In run-time, I can access my RAP custom functions in the RAP Calc Editor,
but not directly in Delphi editor. Example :
In my reports, I have "built-in WHERE", which contains hard-coded WHERE
conditions that must absolutely be passed in the SQL statement. I also have
a function for Parameters Mappings, which contain the mappings between
TppParameters and database fields. These functions didn't have any
parameters, so it worked perfectly.
===============================
raBuiltInWHERE := Report.CodeModule.FindGlobalProgram('BuiltInWHERE');
if raBuiltInWHERE <> nil then
begin
strSQLStatement := strSQLStatement + strWHERE +
raBuiltInWHERE.Execute.AsString;
end;
===============================
My problem is that I have some functions that need to be called from Delphi
and I must be able to pass parameters to that function. I hope my
explanations are clear enough.
David
This discussion has been closed.
Comments
The approach I would try is to create some global Delphi functions that you
can call from your Delphi code. Then create RAP pass-thru functions that
call those same functions. That way you can call the same functions from
native Delphi or RAP code.
The RAP built-in functions that appear in the Code toolbox work in this a
manner. They are RAP functions that internally call Delphi functions.
--
Nard Moseley
Digital Metaphors Corporation
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com