New Blog Post: PDF/A and Metadata

Parameters

edited February 2010 in General
?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

Comments

  • edited February 2010
    I should add, this is ReportBuilder 10.08.


  • edited February 2010
    ?I should add this is Report Builder 10.08.



    --- posted by geoForum on http://www.newswhat.com
  • edited February 2010
    Hi Steve,

    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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2010
    Nico,

    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


  • edited February 2010
    Hi 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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2010
    Is there a wiki or other tutorial on creating custom Autosearch dialogs?


  • edited February 2010
    Hi Steve,

    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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.