What is the best way to pass parameters to a report.
Hi, I was wondering what was the best way to pass some parameters to my
reports. These parameters will be used to choose wich fields I will show in
my report. A TStringList would be the best type of parameter...
I already have a Data Pipeline connected to my report. So I guess I can't
use the TppJITPipeline object, unless we can connect many pipelines to one
report.If we can please let me know how.
Thanks in advance.
Yann St-Germain
reports. These parameters will be used to choose wich fields I will show in
my report. A TStringList would be the best type of parameter...
I already have a Data Pipeline connected to my report. So I guess I can't
use the TppJITPipeline object, unless we can connect many pipelines to one
report.If we can please let me know how.
Thanks in advance.
Yann St-Germain
This discussion has been closed.
Comments
the Autosearch feature in the report builder help file.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
I was able to do what I wanted but is it good practice to pass non
data-filtering parameters via AutoSearch? I do not get any errors saying
that the criteria doesn't match any data. Will it cause me any problems in
the futur?
Here's what I was able to do:
1- I pass my parameters from my application via CreateAutoSearchCriteria():
{...}
ppReport.CreateAutoSearchCriteria('Parameter001', 'Parameter001', soEqual,
'MP1', False);
ppReport.CreateAutoSearchCriteria('Parameter002', 'Parameter002', soEqual,
'MP2', False);
{...}
2- I then can access them in RAP via Report.AutoSearchCriteriaByName() and
do whatever I want with the parameter fields:
procedure GlobalOnCreate;
var
xAutoSearchField: TppAutoSearchField;
begin
xAutoSearchField := Report.AutoSearchCriteriaByName('Parameter001',
'Parameter001');
DBText3.DataField := xAutoSearchField.Value;
xAutoSearchField := Report.AutoSearchCriteriaByName('Parameter002',
'Parameter002');
DBText4.DataField := xAutoSearchField.Value;
end;
Each data-aware control in RB has a datapipeline property and thus can
be connected to a different datapipeline. Using a JITPipeline with a
RecordCount of 1 is another good way to pass parameter info to a report.
AutoSearch, as Jim suggested also works very well.
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Both methods work fine, but I prefer doing it with a TppJITPipeline. I find
it cleaner then with AutoSearch.
By the way, I love your product!!! It's so much flexible!!!
Thanks again.
Yann St-Germain