Parameters
?I'm trying to create a report which will let the end user enter a start
date and an end date which will display all the matching records between
those dates.
I've created 2 parameters: startdate and enddate, and I've set both of
them to datetime.
Now I have this formula to display or hide the detail bands...
procedure DetailBeforePrint;
var
startdate : datetime;
enddate : datetime;
begin
startdate := Report.Parameters['StartDate'].Value;
enddate := Report.Parameters['EndDate'].Value;
if EMPLOYEES['LAST_HIRE_DATE'] >= startdate then
if EMPLOYEES['LAST_HIRE_DATE'] <= enddate then
Detail.Visible := TRUE else
Detail.Visible := FALSE ;
end;
I get this error:
ErrorL DetailBeforePrint, Line 7:Expected '(' or '[', but found 'Value'
instead.
When I leave the .value's off, the procedure compiles, but then the
report fails telling me it cannot convert a string to a datetime. Also,
at no point does it ask me to enter parameter values, so I'm not sure
what I'm doing wrong with that either. Ideally, I would prefer to be
able to pass the parameters to the SQL query so that I only return
matching record instead of having to hide details.
--- posted by geoForum on http://www.newswhat.com
date and an end date which will display all the matching records between
those dates.
I've created 2 parameters: startdate and enddate, and I've set both of
them to datetime.
Now I have this formula to display or hide the detail bands...
procedure DetailBeforePrint;
var
startdate : datetime;
enddate : datetime;
begin
startdate := Report.Parameters['StartDate'].Value;
enddate := Report.Parameters['EndDate'].Value;
if EMPLOYEES['LAST_HIRE_DATE'] >= startdate then
if EMPLOYEES['LAST_HIRE_DATE'] <= enddate then
Detail.Visible := TRUE else
Detail.Visible := FALSE ;
end;
I get this error:
ErrorL DetailBeforePrint, Line 7:Expected '(' or '[', but found 'Value'
instead.
When I leave the .value's off, the procedure compiles, but then the
report fails telling me it cannot convert a string to a datetime. Also,
at no point does it ask me to enter parameter values, so I'm not sure
what I'm doing wrong with that either. Ideally, I would prefer to be
able to pass the parameters to the SQL query so that I only return
matching record instead of having to hide details.
--- posted by geoForum on http://www.newswhat.com
This discussion has been closed.
Comments
--- posted by geoForum on http://www.newswhat.com
1. If you are simply trying to filter your data, you might try using the
AutoSearch feature rather than Report Parameters. Using RB 10, Autosearch
is the only way for RB to ask for a search value and filter the dataset
accordingly. For RB 11, we added the ability to link Report Parameter
values to the Autosearch feature.
2. If you would like to stick with parameters, try typecasting the
parameter and see if that solves the problem. This is a workaround for an
issue we are currently looking into.
lStartDate := DateTime(Report.Parameters['myParameter']);
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Suggestion #2 allowed the report to compile, but when running, it never
prompts me to enter values for the parameters. Instead, I am getting detail
bands for every employee in my database.
Suggestion #1 works. It creates a fairly ugly dialogue box, but at least it
lets me specify a data range.
Thanks for getting it working, but if you have any suggestions how to get #2
to prompt the user for data, I'd appreciate it.
Steve
ReportBuilder 10 did not include the ability to link parameters to
AutoSearch (allowing the users to enter the parameter values using the
AutoSearch dialog). ReportBuilder 11 does include this feature.
All the AutoSearch dialogs are completely replaceable if you would like to
have a custom look.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
The following article explains how to replace dialogs in ReportBuilder.
There is also a demo located in the \Demos\5. AutoSearch\4. Custom
AutoSearch Dialog\... directory.
http://www.digital-metaphors.com/rbWiki/Plugins/Dialogs/Replaceable_Dialogs
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com