0

I have two parameters in my Report - Begin and End Dates which are of Date/Time type. When I select the Begin Date from the Calendar, how do I automatically show dates equal to or greater than Begin Date for the End Date calendar? I would like the have the user the ability to select only End dates after Begin date.

Dale K
  • 25,246
  • 15
  • 42
  • 71
Julaayi
  • 403
  • 2
  • 8
  • 23
  • 1
    Unfortunately, if you set the available value for End date then it stops being a date picker. You can however set a default for the end date as someday greater than Begin date using a dataset query dependent on begin date parameter. – Harry Feb 13 '20 at 20:41
  • So, just add one day to the Start Date? Something like this? - dateadd("d", 1, Parameters!BeginDate.Value) – Julaayi Feb 13 '20 at 22:04
  • 1
    Yes.. use that expression to be the default value for End Date. It should automatically set it to 1 day greater than start date. User can still change it if need be.. but you can't stop them from choosing a lesser date.. perhaps something you could handle in your report.. compare the dates.. if end date is lesser than begin date.. show a message "please select valid End date "or something like that. – Harry Feb 13 '20 at 22:33
  • Adding the above expression helped a bit. Where do I add in the Report to stop the user to not select the lesser date? – Julaayi Feb 13 '20 at 23:39
  • You can't stop them selecting a lesser date. create a dataset that compares the 2 parameters.. if end date is greater than begin date.. show a message box asking them to be wiser with their choice.. but it can only happen after the report has been run.. unfortunately. – Harry Feb 13 '20 at 23:58
  • Is there a limit to END DATES? (i.e. within a month of the begin) Or should the user be able to pick ANY date ever? I'm thinking they can select a Begin date then choose an END DATE from list based on the BEGIN DATE. Might be a little cumbersome without a limit of dates tho. – Hannover Fist Feb 14 '20 at 00:17
  • I had a similar requirement with a begin and end date parameter where the end date has to be greater or equal to the begin date. We did not limit the ability for the end user to select dates they want. If they selected an end date that was before the begin date, we used an expression to default the end date to the same as start date. – papermoon88 Feb 14 '20 at 13:20
  • @Harry Thanks for your inputs. – Julaayi Feb 18 '20 at 17:25
  • @HannoverFist Unfortunately, there is no limit to END DATES. – Julaayi Feb 18 '20 at 17:26
  • @papermoon88 Where do you set that expression? In the actual text box? – Julaayi Feb 18 '20 at 17:26

1 Answers1

0

This could be a potential workaround going off the comment I made to your question. You would need three datetime parameters:

-#1 StartDate

-#2 EndDate

-#3 EndDate2 - make this hidden

The StartDate and EndDate (#1 and #2) are for users to select. For the report, we will use StartDate (#1) and EndDate2 (#3) to filter.

You can set the default for StartDate/EndDate however you would like. For EndDate2, if the user selects a date prior to the start date, default the end date that gets passed to the report. We set this by adjusting the default value for EndDate2 parameter with the IIF function to compare the user input dates.

Add this to default value for EndDate2 parameter:

=IIF(Parameters!EndDate.Value < Parameters!StartDate.Value, Parameters!StartDate.Value, Parameters!EndDate.Value )
papermoon88
  • 456
  • 2
  • 8