Take a look at the AutoSearch feature in ReportBuilder. This allows you to change the Where clause on the fly in order to filter the report output after generation. There are numerous examples of using the Autosearch feature in the Report Explorer demo as well as in the \RBuilder\Demos\AutoSearch\... directory.
I need to change parameters in WHERE clause in aplication like \RBuilder\Demos\4. EndUser Databases\Oracle 8\3. DOA\enduser.dpr.
Example (in Oracle):
1) Compile & run \RBuilder\Demos\4. EndUser Databases\Oracle 8\3. DOA\enduser.dpr 2) Create New Report 3) On "Data", "Query Design", "SQL", right click and select "Edit SQL" and specity this query " SELECT * FROM ALL_TABLES WHERE OWNER='SYS' " 4) Create report with fields OWNER and TABLE_NAME 5) Save Report
How to transform 'SYS' in parameter ? How to user specify ONWER NAME in the enduser.dpr without change application code ? (change only Report Template)
If you have RB 9.0x you can use the TdaSQLBuilder object to easily alter the SQL object in RAP. Take a look at the TdaSQLBuilder topic in the ReportBuilder help file for detailed information on how it is to be used and many code examples.
The code you have below should work provided "All_TABLES" is the name of a single table in your database, "OWNER" is a field in the ALL_TABLES table and you uncomment the "lSQLBuilder.ApplyUpdates" line.
Sorry, you are correct, the ApplyUpdates is called automatically in RAP. In my testing with code almost identical to yours, I was able to get a successful output. This was using the DBDEMOS database included with Delphi. Below is my RAP code.
procedure ReportBeforeOpenDatapipelines; var lSQLBuilder : TdaSQLBuilder; begin
Comments
Take a look at the AutoSearch feature in ReportBuilder. This allows you to
change the Where clause on the fly in order to filter the report output
after generation. There are numerous examples of using the Autosearch
feature in the Report Explorer demo as well as in the
\RBuilder\Demos\AutoSearch\... directory.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I need to change parameters in WHERE clause in aplication like
\RBuilder\Demos\4. EndUser Databases\Oracle 8\3. DOA\enduser.dpr.
Example (in Oracle):
1) Compile & run \RBuilder\Demos\4. EndUser Databases\Oracle 8\3.
DOA\enduser.dpr
2) Create New Report
3) On "Data", "Query Design", "SQL", right click and select "Edit SQL" and
specity this query " SELECT * FROM ALL_TABLES WHERE OWNER='SYS' "
4) Create report with fields OWNER and TABLE_NAME
5) Save Report
How to transform 'SYS' in parameter ? How to user specify ONWER NAME in the
enduser.dpr without change application code ? (change only Report Template)
The RAP can resolve this ?
Thanks,
Samuel
If you have RB 9.0x you can use the TdaSQLBuilder object to easily alter the
SQL object in RAP. Take a look at the TdaSQLBuilder topic in the
ReportBuilder help file for detailed information on how it is to be used and
many code examples.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I try but this not work (see sample).
I specify the code bellow in ReportBeforeOpenDataPipelines,
ReportOnInitializeParameters, OnCreate:
var
lSQLBuilder : TdaSQLBuilder;
begin
lSQLBuilder := TdaSQLBuilder.Create(Report.DataPipeline);
lSQLBuilder.Clear;
lSQLBuilder.SelectTables.Add('All_TABLES');
lSQLBuilder.SelectFields.AddAllFields;
lSQLBuilder.SearchCriteria.AddAutoSearch('ALL_TABLES', 'OWNER',
'Like', 'WRO');
{ lSQLBuilder.ApplyUpdates;}
lSQLBuilder.Free;
end;
What is happening ?
Samuel
The code you have below should work provided "All_TABLES" is the name of a
single table in your database, "OWNER" is a field in the ALL_TABLES table
and you uncomment the "lSQLBuilder.ApplyUpdates" line.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
When uncomment "ApplyUpdates" I receive this error in RAP (..."'(' or '['
expected...." ).
My Report Builder is 9.02 Enterprise Edition.
Samuel
Sorry, you are correct, the ApplyUpdates is called automatically in RAP. In
my testing with code almost identical to yours, I was able to get a
successful output. This was using the DBDEMOS database included with
Delphi. Below is my RAP code.
procedure ReportBeforeOpenDatapipelines;
var
lSQLBuilder : TdaSQLBuilder;
begin
lSQLBuilder := TdaSQLBuilder.Create(Report.DataPipeline);
lSQLBuilder.Clear;
lSQLBuilder.SelectTables.Add('customer');
lSQLBuilder.SelectFields.AddAllFields;
lSQLBuilder.SearchCriteria.AddAutoSearch('customer', 'company', 'Like',
'K');
lSQLBuilder.Free;
end;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com