At what point in time are you looking to access your dataset? As a general rule of thumb, it is not a good idea to access or manipulate your data once the report has begun generating. The easiest/most robust way to do this would be to access your dataset before the report is printed then execute the code based on the data value your receive. Perhaps more information about what you are trying to accomplish would help.
ReportBuilder will not execute any SQL code until the report is being generated. If you need to execute a query before the report generates, you will need to access the datasets directly (perhaps using Delphi components such as TQuery, etc.). In order to do this from RAP, you would need to create a pass thru function which access the data in Delphi and returns the needed value.
Sorry, the previous post assumes you are using RAP.
If you are, take a look at the article below on extending RAP (creating pass thru functions etc.). I would suggest getting this working in Delphi first regardless then moving the code to RAP if you need.
There are two very simple and powerful techniques to extend the capabilities of RAP infinitely. These are summarized below and covered in more detail in the RAP.hlp online help. Demos and tutorials are installed to RBuilder\Demos\RAP. The tutorial text is located in RAP.hlp.
1. RAP Pass-Through Functions
These are functions that appear in the Language tab of RAP's Code Toolbox. These functions are written in Delphi and can be called from RAP. RAP's pass-through function architecture enable's developers to add new built-in functions to RAP's code toolbox.
2. Extend RAP's RTTI
RAP's Run-time Type information defines what classes and properties can be accessed via RAP. By default the published properties of any class that is registered with Delphi's RegisterClass procedure is recognized by RAP. In addition many of the public properties and methods of ReportBuilder classes are exposed.
Comments
At what point in time are you looking to access your dataset? As a general
rule of thumb, it is not a good idea to access or manipulate your data once
the report has begun generating. The easiest/most robust way to do this
would be to access your dataset before the report is printed then execute
the code based on the data value your receive. Perhaps more information
about what you are trying to accomplish would help.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I would like to execute a SQL statement in the beforeopendatapipeline event.
I've got a report that can be run from 2 different versions of an
application.
However, for 1 version, it will execute some code (eg join other tables).
But for the other version,
Its not necessary. I have a table in the database that will return the
version number of the application.
Basically, I want to perform a select statement to that table to get the
version number. Then, depending on the
Version number, execute the code beforeOpenDataPipeline. Is this possible?
The part I'm having troubles with is to actually
Execute a select statement and use the result.
Thanks.
Andrew
ReportBuilder will not execute any SQL code until the report is being
generated. If you need to execute a query before the report generates, you
will need to access the datasets directly (perhaps using Delphi components
such as TQuery, etc.). In order to do this from RAP, you would need to
create a pass thru function which access the data in Delphi and returns the
needed value.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
If you are, take a look at the article below on extending RAP (creating pass
thru functions etc.). I would suggest getting this working in Delphi first
regardless then moving the code to RAP if you need.
--------------------------------------------------
Article: Extending RAP
---------------------------------------------------
There are two very simple and powerful techniques to extend the capabilities
of RAP infinitely. These are summarized below and covered in more detail in
the RAP.hlp online help. Demos and tutorials are installed to
RBuilder\Demos\RAP. The tutorial text is located in RAP.hlp.
1. RAP Pass-Through Functions
These are functions that appear in the Language tab of RAP's Code Toolbox.
These functions are written in Delphi and can be called from RAP. RAP's
pass-through function architecture enable's developers to add new built-in
functions to RAP's code toolbox.
2. Extend RAP's RTTI
RAP's Run-time Type information defines what classes and properties can be
accessed via RAP. By default the published properties of any class that is
registered with Delphi's RegisterClass procedure is recognized by RAP. In
addition many of the public properties and methods of ReportBuilder classes
are exposed.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com