AutoSearchFields
Hi,
We use RBuilder Enterprise 6.03 with Delphi 6 enterprise.
Our reports are stored in an SQL Server DB.
Reports are made using RAP.
We want to do the following:
1) Master DADE Query with autosearchfields (1 + 2)
2) Another DADE Query with autosearchfields (3 + 4). This query is not
related to the first one. It is displayed in a subreport in the summary
band.
What I want to do is:
Set parameter 3 = parameter 1
set parameter 4 = parameter 2
the parameters are dates, so I would let the user specify the dates once,
and put them myself to the other query.
There is something like 'Report.AutoSearchFields[x] := yyyyy'
But this does not seem to work over more than 1 query.
Any ideas? I would like to solve this problem using RAP code if possible.
Regards,
Wouter Devos
XLent Solutions
We use RBuilder Enterprise 6.03 with Delphi 6 enterprise.
Our reports are stored in an SQL Server DB.
Reports are made using RAP.
We want to do the following:
1) Master DADE Query with autosearchfields (1 + 2)
2) Another DADE Query with autosearchfields (3 + 4). This query is not
related to the first one. It is displayed in a subreport in the summary
band.
What I want to do is:
Set parameter 3 = parameter 1
set parameter 4 = parameter 2
the parameters are dates, so I would let the user specify the dates once,
and put them myself to the other query.
There is something like 'Report.AutoSearchFields[x] := yyyyy'
But this does not seem to work over more than 1 query.
Any ideas? I would like to solve this problem using RAP code if possible.
Regards,
Wouter Devos
XLent Solutions
This discussion has been closed.
Comments
RAP pass through function to implement anythign that isn't currently
surfaced in RAP. If the second query has DADE defined autosearch criteria
objects ont eh dataview, then there should be autosearch fields created as a
result. There should also be two tabs in the autosearch dialog to show the
different search criteria, 1 and 2 on the first tab, and 3 and 4 on the
second tab. If you want to simply define criteria on the second dataview,
then you'll have to use the OnGetAutosearchValues event of the report in
order to set the criteria values directly on the detail SQL object. Here is
an example of altering the criteria on a SQL object. You'll have to find the
dataview in code for the subreport. Also, check out the autosearch demos.
There is one which alters the autosearch search expression for the
autosearch fields that are created at runtime to support the DADE search
criteria.
http://www.digital-metaphors.com/tips/ExtractSQLObject.zip
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
Thanks for the help. I was mistaken about the AutoSearchFieldCount.
Everything works like it should be.
So in the OnGetAutoSearchValues, you can set every value you want. I don't
even need to write any Delphi or pass through code.
Thanks,
Wouter Devos
XLent Solutions
Would you mind sharing some hints on how you did this? I think I have the
same problem. I've got two dataviews, and both of them should search within
a daterange, and I want them to use the same daterange (the user only has to
input it once).
I've tried writing to the Criterias in several ways, and on several Event
handlers, but with no success. Did you solve it with GetSQLObject ? And on
what Event handler?
Best Regards,
Paul
My problem was with an SQL statement (DADE SQL), and another (fixed) DADE
SQL. Only the second SQL statement had to have the same date range of the
first.
In the OnGetSearchValues event, I did the following
Report.AutoSearchFields[5].SearchExpression :=
Report.AutoSearchFields[1].SearchExpresion.
(where parameter 5 is the first parameter of the second SQL). You have to
number all autosearchfields, beginning with 0.
You need to specify all dates with the AutoSearch checkbox. The only thing
I did was creating my own autosearchforms. So when I need a date range I
only ask a beginning and ending date. These dates I fill in the first
autosearchvalues of the first query, and in the OnGetAutoSearchValues event,
I set the parameters for the second query.
I did this all in the end-userd environment, so no GetSQLObject routine was
needed.
If you want some more information, please ask.
Regards,
Wouter Devos
Thanks!
I wanted to avoid having to customize the searchform, because we have
already made our own customized version of this (to make it work/look the
same on the web).
I guess I'll find a way. Maybe by changing our custom searchform again into
autodetecting searches on the same field in the same table, and then
prompting for only one input.
Best Regards,
Paul