Report Builder 3.0 SWITCH和嵌套的IIF都抛出相同的错误[BC32017]

问题描述 投票:0回答:1

我正在使用报表生成器3.0,试图根据用户选择的参数获取动态标题。

错误

textrun的值表达式‘Textbox29.Paragraphs [2] .TextRuns [0]”包含错误:[BC32017]逗号,')',或预期的有效表达式继续。

使用此SWITCH语句时出现此错误

=SWITCH(
Parameters!LineCalled.Count = 3, "All Lines",
Parameters!LineCalled.Count = 2, "Both Notts Lines",
Parameters!LineCalled.Count = 1 AND
Parameters!LineCalled.Value = "01156842190", "Order Line",
Parameters!LineCalled.Count = 1 AND
Parameters!LineCalled.Value = "01156842191", "Overflow Line",
Parameters!LineCalled.Count = 1 AND
Parameters!LineCalled.Value = "393607", "Belfast Line"

)

或此IIF

=IIF(Parameters!LineCalled.Count = 3, "All Lines",
IIF(Parameters!LineCalled.Count = 2, "Both Notts Lines",
IIF(Parameters!LineCalled.Count = 1 AND
Parameters!LineCalled.Value = "01156842190", "Order Line",
IIF(Parameters!LineCalled.Count = 1 AND
Parameters!LineCalled.Value = "01156842191", "Overflow Line",
IIF(Parameters!LineCalled.Count = 1 AND
Parameters!LineCalled.Value = "393607", "Belfast Line","Other"
)))))

我想念什么?

reporting-services switch-statement iif-function
1个回答
0
投票

缺少的是,您的参数似乎是一个多值参数,因此,每当要访问唯一选定的值时,都应使用表达式Parameters!LineCalled.Value(0)

例如:

=SWITCH(
  Parameters!LineCalled.Count >= 3, "All Lines",
  Parameters!LineCalled.Count = 2, "Both Notts Lines",
  Parameters!LineCalled.Value(0) = "01156842190", "Order Line",
  Parameters!LineCalled.Value(0) = "01156842191", "Overflow Line",
  Parameters!LineCalled.Value(0) = "393607", "Belfast Line"
)
© www.soinside.com 2019 - 2024. All rights reserved.