简体   繁体   English

SSRS报告订阅日期参数

[英]SSRS Report subscription date parameters

The thing that I want to do is as follows I have a SQL reporting services report that takes date parameter (I have two parameters as Run_Report_From_Date_PARM and Run_Report_To_Date_PARM . These dates are picked from the Datepicker). 我要做的事情如下:我有一个带日期参数的SQL Reporting Services报告(我有两个参数,分别为Run_Report_From_Date_PARMRun_Report_To_Date_PARM 。这些日期是从Datepicker中选取的)。 I want to create a subscription to the report that will run on 1st of every month and show the data for the prior month. 我想为该报表创建一个订阅,该订阅将在每个月的1号运行,并显示上个月的数据。

While making subscription if i choose 2016-08-01 for Run_Report_From_Date_PARM and 2016-09-01 for Run_Report_To_Date_PARM then the report is generating always with that date range only. 进行订阅时,如果我为Run_Report_From_Date_PARM选择2016-08-01并为Run_Report_To_Date_PARM选择2016-09-01,则该报告将始终仅使用该日期范围生成。 But i need the date ranges modify automatically after every month(like for the next month From date should be 2016-09-01 and to date should be 2016-10-01 ). 但是我需要每个月后自动修改日期范围(例如下个月,起始日期应该是2016-09-01,而到目前为止应该是2016-10-01)。

What is simplest is to just use expressions to set the default values for these parameters. 最简单的是仅使用表达式来设置这些参数的默认值。

For a start date of the first of last month: 对于上个月第一天的开始日期:

=DateAdd("m", -1, DateAdd("d", 1 + -1 * DatePart("d", Today()), Today()))

For an end date of the last of last month: 对于最后一个月的结束日期:

=DateAdd("d", -1 * DatePart("d", Today()), Today())

However, if you don't want these to be the default values when executing the report, you can set up a hidden boolean parameter that you only set to true in the subscription settings. 但是,如果您不希望在执行报表时将这些设置为默认值,则可以设置一个隐藏的布尔参数,仅在订阅设置中将其设置为true。 That can be useful if you need to include formatting or default value tweaks in the subscription version of a report. 如果您需要在报表的订阅版本中包括格式设置或默认值调整项,这将很有用。

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

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