Report Builder - Set datetime parameter

AboutDev picture AboutDev · Jul 7, 2009 · Viewed 15.3k times · Source

I have a report that has parameters StartDate and EndDate. I would like the EndDate parameter's time part to default to the end of the day when selected from the drop down.

For instance, if a user selects 5/15/2008 from the dropdown, the value shown in the box should be '5/15/2008 23:59:59' not '5/15/2008 12:00:00'

Its pretty easy to do this in .Net using the event model and a line of code but in Report Builder 2.0, what would I need to do?

Is there code that I need to write for this or did I miss some funky expression that could handle this?

Thanks.

AboutDev

Answer

Nathan Fisher picture Nathan Fisher · Jul 14, 2009

I would suggest setting the default parameter in the Report Parameters section. You can get to this from Report > Report Parameters.

This allows you to set a non-queried default. There you can enter an expression like

=DateAdd(Microsoft.VisualBasic.DateInterval.Second ,-1,dateadd("d",1,Today))

That should give you a default for the end of today.

Edit: Really only useful for a single default value.