SSRS:参数'VarExpr'不是有效值

时间:2015-01-08 18:05:00

标签: ssrs-2008

我正在尝试根据SSRS中的Datepart计算来计算月份名称。这段代码正在运行但有警告..

=Switch(DATEPART(DateInterval.Month,Fields!TRANSACTION_DATE.Value)=12,"December",
DATEPART(DateInterval.Month,Fields!TRANSACTION_DATE.Value)=11,"November",
DATEPART(DateInterval.Month,Fields!TRANSACTION_DATE.Value)=10,"October",
DATEPART(DateInterval.Month,Fields!TRANSACTION_DATE.Value)=9,"September",
DATEPART(DateInterval.Month,Fields!TRANSACTION_DATE.Value)=8,"August",
DATEPART(DateInterval.Month,Fields!TRANSACTION_DATE.Value)=7,"July",
DATEPART(DateInterval.Month,Fields!TRANSACTION_DATE.Value)=6,"June",
DATEPART(DateInterval.Month,Fields!TRANSACTION_DATE.Value)=5,"May",
DATEPART(DateInterval.Month,Fields!TRANSACTION_DATE.Value)=4,"April",
DATEPART(DateInterval.Month,Fields!TRANSACTION_DATE.Value)=3,"March",
DATEPART(DateInterval.Month,Fields!TRANSACTION_DATE.Value)=2,"February",
DATEPART(DateInterval.Month,Fields!TRANSACTION_DATE.Value)=1,"January")

警告:

[rsRuntimeErrorInExpression] The Value expression for the field ‘MONTH_NAME’ contains an error: Argument 'VarExpr' is not a valid value.    

请建议如何删除此错误。

1 个答案:

答案 0 :(得分:0)

根据您的表达式,您应该能够使用更简单的表达式和不同的日期函数:

=MonthName(Month(Fields!TRANSACTION_DATE.Value))