Using fields in one table to define a query from another table
Is there a way to use RAP or DADE to construct a query based upon two fields
in a table?
I think I know how to do this programmatically in Delphi, but I wonder if
there is a way to do it on the end user side. I do not have much experience
with RAP, but I am interested in learning how to use it more so that I can
teach my end users how to construct their own reports without having to put
out a new update of the software.
The details are this. I have an operating summary file which contains one
record with many fields holding various summaries of transactions. The
record has two fields called "FirstTransNo" and "LastTransNo." These fields
represent the transaction range from which the particular summary was
constructed. I want to setup a subreport to print the transaction detail
following the operating summary report itself. It needs to do the query as:
Select * from Trans
where TransNo>=tbEodSum.FieldByName('FirstTransNo').AsInteger
and TransNo<=tbEodSum.FieldByName('LastTransNo').AsInteger
What is the best way to approach this using DADE and RAP? Is there a
certain event I should put code in to do this, or is it best for me to
define the query in Delphi and hookup a datapipeline to the query.
I suspect that perhaps I could use parameters which are modified through RAP
at runtime. If so, in which RAP event should I place the code to modify the
parameters?
David Miller.
in a table?
I think I know how to do this programmatically in Delphi, but I wonder if
there is a way to do it on the end user side. I do not have much experience
with RAP, but I am interested in learning how to use it more so that I can
teach my end users how to construct their own reports without having to put
out a new update of the software.
The details are this. I have an operating summary file which contains one
record with many fields holding various summaries of transactions. The
record has two fields called "FirstTransNo" and "LastTransNo." These fields
represent the transaction range from which the particular summary was
constructed. I want to setup a subreport to print the transaction detail
following the operating summary report itself. It needs to do the query as:
Select * from Trans
where TransNo>=tbEodSum.FieldByName('FirstTransNo').AsInteger
and TransNo<=tbEodSum.FieldByName('LastTransNo').AsInteger
What is the best way to approach this using DADE and RAP? Is there a
certain event I should put code in to do this, or is it best for me to
define the query in Delphi and hookup a datapipeline to the query.
I suspect that perhaps I could use parameters which are modified through RAP
at runtime. If so, in which RAP event should I place the code to modify the
parameters?
David Miller.
This discussion has been closed.
Comments
ReportBuilder 9 includes some new features that enable RAP to be used to
modify queries
- there are two new events that were added to facilitate initializing
report parameters and modifying SQL: Report.OnInitializeParameters and
BeforeOpenDataPipelines.
- there is a new TdaSQLBuilder class that can be used to modify the TdaSQL
object associated with a DADE datapipeline. This class is available from RAP
code and Delphi code. See the online help for TdaSQLBuilder - there are
links to subtopics that include sample code
You can also extend RAP with custom functions, see more below...
--------------------------------------------------
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.
--
Tech Support mailto:support@digital-metaphors.com
Digital Metaphors http://www.digital-metaphors.com
--
Nard Moseley
Digital Metaphors Corporation
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
particular application is using RB7. I can't move up to 9 right now because
many of its reports are using RB-AddOn components which I am told do not
work under RB9.
The OnInitializeParameters sounds like what I need to use in RB9. What
about in RB7? Can the BeforeAutoSearchDialogCreate or
AfterAutoSearchDialogue be used even if there is no auto search dialogue?
If not, I guess it might just be best to do this in Delphi, setting up my
own query first. Thank you for your feedback.
David Miller.
BeforeAutoSearchDialogCreate will only fire if you defined autosearch
criteria using the query designer. You can use this event to set
Report.ShowAutoSearchDialog to False.
We made enhancements to RB 9 to specifically improve areas of the product
such as this one.
--
Nard Moseley
Digital Metaphors Corporation
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
to work.
In terms of future update requests, is there any chance of having an
RichText component like the RBAddOn one that allows merge capability? That
is the component that I have become very dependent upon. I have many
contracts, receipts, letters, etc., and the merge feature is very valuable.
My end users love it. I wish you guys would just buy that one component
from Bruce Roberts and keep it updated with your latest version. :-)
David Miller.
ReportBuilder 9 contains significant enhancements to the RichText MailMerge
feature. You can merge fields from any datapipeline and specify display
format strings.
Here is a flash demo
http://www.digital-metaphors.com/demos/mailmerge.swf
You can download a trial version to check it out further...
--
Nard Moseley
Digital Metaphors Corporation
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
need. Thanks.