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

add day to AutoSearch date

edited March 2005 in End User
Hello,

I need to add one day to whatever date the end-user enters when running the
report. For example, if the user enters "03/08/05" as the date, I want the
system to consider that as "03/09/05" -- I can't figure out what code to
enter to get this to work. I'd appreciate any guidance you can give me.

Thanks,

Blair

Comments

  • edited March 2005
    Hi Blair,

    Try using the OnGetAutoSearchValues event to access the autosearch fields
    and change the date accordingly. ReportBuilder automatically converts all
    dates into TDateTime types so you should be able to simply add 1 to this
    value to add a day.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2005
    Thank you Nico -- I think I'm close to getting this like I need it...but I
    need a little more help.
    I was able to get my labels to display an extra day, but how do I get the
    search to include the extra day?

    Here's what I have in the OnGetAutoSearchValues event:

    var aField: TppAutoSearchField;

    begin

    aField:=Report.AutoSearchCriteriaByName('mydataview','myfield');

    aField.values[1]:=aField.values[1]+1;

    end;


    But am I "allowed" to define a value using itself? I'm not getting any
    error messages but the search is not including the extra day.

    Thanks for any more help you can give -
    -- Blair


  • edited March 2005
    Hi Blair,

    The TppAutoSearchField.Value and TppAutoSearchField.Values properties are
    read only (I'm not sure why you are able to even complile). The way the
    autosearch feature works is it takes your user input, than updates your
    datset by altering the search criteria. When you get the value in the
    OnGetAutoSearchValues event, you are intercepting its normal route so you
    can alter it then change the search criteria of your dataset manually.

    Are you by chance using DADE to create this AutoSearch criteria?

    --
    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.