简体   繁体   English

SSRS 2012表达式生成器Today()错误

[英]SSRS 2012 Expression builder Today() error

I have two SSRS Parameters, Date/Time type: BeginDate and EndDate. 我有两个SSRS参数,日期/时间类型:BeginDate和EndDate。 I want them to default to EndDate=Today() and BeginDate=Today()-six months. 我希望它们默认为EndDate = Today()和BeginDate = Today()-六个月。 Using Report Parameters, Default Values, I add a value and create the function =Today() but I get the red squiggly line under the parens. 使用报表参数,默认值,我添加一个值并创建函数= Today(),但我得到了parens下的红色波浪线。

If I select the function from the Category list and double click it into the "Set Expression for:Value" box, I get the function with a single open-paren and the red squiggly which remains if I close off with a close-paren. 如果我从“类别”列表中选择该功能并将其双击到“设置表达式:值”框中,我将获得具有单个开放式按钮的功能,如果我以近距离关闭,则会保留红色波浪线。

I get the same error if (following the example in the "Example" section, for crist's sake) of =DateAdd("m", -6, Today()) I get the same error instead of a date six months prior. 我得到相同的错误,如果(按照“示例”部分中的示例,为了crist的缘故)= DateAdd(“m”, - 6,Today())我得到相同的错误而不是六个月前的日期。

A little help please...? 请帮助一下......?

Thanks 谢谢

The problem is that you are using SQL command syntax but Reporting Services uses VBA. 问题是您使用的是SQL命令语法,但Reporting Services使用VBA。

Even though the examples show Today() with the brackets after it, as if it was a method, that actually displays as a syntax error for me in the expression editor. 即使示例显示的Today()后面都有方括号,就好像它是一个方法一样,实际上在表达式编辑器中对我来说显示为语法错误。 Today's date is simply accessed like a property: 今天的日期只是像财产一样被访问:

=Today

DateAdd exists but uses DateInterval properties, not the SQL "m" so six months ago is: DateAdd存在,但使用DateInterval属性,而不是SQL "m"因此六个月前为:

=DateAdd(DateInterval.Month, -6, Today)

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

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