Date Parameters question
Hi there,
I need do to some check when the user inputs dates into a start date and end date. if the user enters the end date less than the start date, give him a warning that end date cannot be less than start date.
Thanks,
Manny
April 27th, 2011 11:18am
I'd rather set the EndDate parameter such that the list of dates in the end date parameter are later than the start date. This way there is no possibly of running into that situation.
Something like
SELECT EndDate FROM Table WHERE EndDate > @StartDate
Free Windows Admin Tool Kit Click here and download it now
April 27th, 2011 11:37am
Hi midway11,
From your description, the report has two parameters which are “StartDate” and “EndDate”. In order to achieve this, we can add a textbox to the report and use an expression to control the warning message is showed or hidden. If the warning
message is showed, the report contents will be hidden. Please refer to the steps below:
1. Drag a Text Box from the Toolbox to the design surface, and then type in warning message what you want.
2. Right-click the Text Box and select Text Box Properties, and then click “Visibility”.
3. Choose the “Show or hide based on an expression” option, click “fx” button, set the expression like this:
=IIF(Parameters!StartDate.Value>Parameters!EndDate.Value,False,True)
4. Using an expression to control the report contents are showed or hidden. (For example, we have a Table in the report, select the Table). In the Properties window, set the “Hidden” property to the expression like this:
=IIF(Parameters!StartDate.Value>Parameters!EndDate.Value,True,False)
If the EndDate is less than the StartDate, click the preview button, the warning message will be showed and the report contents will be hidden.
If you have any questions, please feel free to ask.
Regards,
Bin Long
May 3rd, 2011 4:02am
Manny
Is that possible to check it on the client site before passing parameters or is that user calls reports from RM?Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
Free Windows Admin Tool Kit Click here and download it now
May 3rd, 2011 4:07am