如何在 SSRS 文本框的表达式 属性 中测试两个字段值?
How can I test for two field values in an SSRS Textbox's Expression property?
我在文本框中成功使用了这个表达式:
=IIF((Fields!Week.Value="WK1"),Fields!Price.Value,"")
不过,我需要更细化 - 我不仅在为该特定列分配 Price 字段的值之前寻找 "WK1" 的周值,而且还基于单位字段。
所以我希望这样的表达式有效:
=IIF((Fields!Week.Value="WK1" && Fields!Unit.Value="Rock Bottom"),Fields!Price.Value,"")
...或者这个:
=IIF(((Fields!Week.Value="WK1") && (Fields!Unit.Value="Rock Bottom")),Fields!Price.Value,"")
...但是当我尝试在其中任何一个之后预览结果时,我得到,“报告预览失败,因为无法构建报告。请阅读错误、警告和消息特定构建失败的错误列表 window。"
该消息是:
[rsCompilerErrorInExpression] The Value expression for the textrun
‘TextboxCraftworksPriceWk1Data.Paragraphs[0].TextRuns[0]’ contains an
error: [BC30201] Expression expected.
所以它说需要一个表达式;这些表达式怎么不是表达式?
现在 John Mellencamp 的“Without Expression”曲调在我的脑海中闪过。
From Expression Reference (Report Builder and SSRS)
Expressions must have valid Visual Basic syntax before a report can be published or processed.
考虑到这一点,您应该使用 logical And
operator as @alejandro-zuleta pointed out in the 。
=IIF((Fields!Week.Value="WK1" And Fields!Unit.Value="Rock Bottom"), Fields!Price.Value, "")
有用的链接
我在文本框中成功使用了这个表达式:
=IIF((Fields!Week.Value="WK1"),Fields!Price.Value,"")
不过,我需要更细化 - 我不仅在为该特定列分配 Price 字段的值之前寻找 "WK1" 的周值,而且还基于单位字段。
所以我希望这样的表达式有效:
=IIF((Fields!Week.Value="WK1" && Fields!Unit.Value="Rock Bottom"),Fields!Price.Value,"")
...或者这个:
=IIF(((Fields!Week.Value="WK1") && (Fields!Unit.Value="Rock Bottom")),Fields!Price.Value,"")
...但是当我尝试在其中任何一个之后预览结果时,我得到,“报告预览失败,因为无法构建报告。请阅读错误、警告和消息特定构建失败的错误列表 window。"
该消息是:
[rsCompilerErrorInExpression] The Value expression for the textrun ‘TextboxCraftworksPriceWk1Data.Paragraphs[0].TextRuns[0]’ contains an error: [BC30201] Expression expected.
所以它说需要一个表达式;这些表达式怎么不是表达式?
现在 John Mellencamp 的“Without Expression”曲调在我的脑海中闪过。
From Expression Reference (Report Builder and SSRS)
Expressions must have valid Visual Basic syntax before a report can be published or processed.
考虑到这一点,您应该使用 logical And
operator as @alejandro-zuleta pointed out in the
=IIF((Fields!Week.Value="WK1" And Fields!Unit.Value="Rock Bottom"), Fields!Price.Value, "")