Home End User
New Blog Posts: Merging Reports - Part 1 and Part 2

Setting Parameter value

edited August 2010 in End User
Hi,

I am using RB 11.08 Enterprise.

I have defined a parameter of ReportStartDate and I want the value shown
to the user in the Autosearch prompt to show the first of the month of
the current date.

I defined the following in the Calc procedure.

procedure ReportOnInitializeParameters(var aCancel: Boolean);
var
Year, Month, Day: integer;
EndDay: integer;
begin
DecodeDate(CurrentDate, Year, Month, Day);
Report.Parameters['ReportStartDate'] := DateToStr(EncodeDate(Year,
Month, 01));

end;

This does not change the value as shown to the user in the autosearch
prompt.

Thanks for your help,
Phil

Comments

  • edited August 2010
    Hi Phil,

    In my testing with your exact code below and RB 12.01, the date successfully
    changed to the first of the month when bringing the autosearch dialog up.
    My first suggestion would be to implement this event in Delphi so you can
    debug it and see exactly what is happening. Be absolutely sure the name of
    the parameter matches the name used to access it in the InitializeParameters
    routine.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

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

    Sorry, but I can't "see" how I would set up an event in Delphi for an
    end-user report. Can you point me to some example that would show that?

    Do I need to define anything other than these properties for the Parameter:
    DataType: dtDate
    UserName: ReportStartDate

    I double-checked and the names do match.

    I do have properties assigned for the AutosearchSettings too, but I
    assume they are not relevant here.

    Thanks,
    Phil


  • edited August 2010
    Hi Phil,


    This would be done in a separate test application for debug purposes only.
    It simply makes it easier to debug code that will eventually be placed in
    RAP.

    I checked and I believe the reason this is not working is that we enhanced
    RB 12 to allow setting the value of a parameter from RAP. I believe in RB
    11.08 the code compiles but does not function correctly due to the fact that
    the default property is read only. I suggest downloading a trial copy of
    ReportBuilder 12 and testing with that.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

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

    Thanks for checking. I will try this.

    Phil

This discussion has been closed.