SSRS中的参数值(Values For Parameters In SSRS)

编程入门 行业动态 更新时间:2024-10-27 22:28:20
SSRS中的参数值(Values For Parameters In SSRS)

我正在使用Visual Studio 2012和SQL Server 2012。

我创建了两个参数,StartDate和EndDate,它们都是日期/时间参数。

在我的EndDate参数中,我已将默认值设置为Today()以获取今天的日期。

对于我的StartDate参数,我希望它以以下方式基于EndDate参数。 无论用户选择什么日期作为结束日期,StartDate将是24个月/ 2年前的日期。 (例如,如果EndDate是今天(2017年1月11日)......那么StartDate将是2015年1月11日。)

在表达式框中,这是我到目前为止我的StartDate默认值。 =DateAdd(DateInterval.Year,-2,Today())

我如何获得它,以便每次更改EndDate时,StartDate相应地更新为2年前?

I am using Visual Studio 2012 and SQL Server 2012.

I have created two parameters, StartDate and EndDate, which are both Date/Time parameters.

In my EndDate parameter, I have set the Default Value to Today() in order to get today's date.

For my StartDate parameter, I want it to be based off the EndDate parameter in the following way. Whatever date the user selects as End Date, StartDate will be the date 24 months/2 years prior. (For example, if EndDate was Today (1/11/2017)...then StartDate would be 1/11/2015.)

In the expressions box, this is what I have so far for my default value for 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?

最满意答案

试试这个表达式它将在2015年1月22日返回

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

Try this expression it will return 1/22/2015

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

更多推荐

本文发布于:2023-08-04 14:52:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1418829.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:参数   SSRS   Parameters   Values

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!