简体   繁体   English

SSRS中参数的值

[英]Values For Parameters In SSRS

I am using Visual Studio 2012 and SQL Server 2012. 我正在使用Visual Studio 2012和SQL Server 2012。

I have created two parameters, StartDate and EndDate, which are both Date/Time parameters. 我创建了两个参数StartDate和EndDate,它们都是Date / Time参数。

In my EndDate parameter, I have set the Default Value to Today() in order to get today's date. 在我的EndDate参数中,我将默认值设置为Today()以获得今天的日期。

For my StartDate parameter, I want it to be based off the EndDate parameter in the following way. 对于我的StartDate参数,我希望它以以下方式基于EndDate参数。 Whatever date the user selects as End Date, StartDate will be the date 24 months/2 years prior. 无论用户选择什么日期作为结束日期,StartDate都将是24个月/ 2年之前的日期。 (For example, if EndDate was Today (1/11/2017)...then StartDate would be 1/11/2015.) (例如,如果EndDate是Today(1/11/2017)...那么StartDate将是1/11/2015。)

In the expressions box, this is what I have so far for my default value for StartDate. 在表达式框中,这是到目前为止我对StartDate的默认值的了解。 =DateAdd(DateInterval.Year,-2,Today())

How do I get it, so that every time I change the EndDate, the StartDate updates accordingly to be 2 years prior? 如何获取它,以便每次更改EndDate时,StartDate都相应更新为2年?

试试这个表达式它将返回1/22/2015

=Date.Now.Date.AddYears(-2).AddDays(10)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM