我正在处理一个表达式,它将根据两个不同列的值更改单元格背景颜色。一列是百分比,另一列是表示文件大小(gb)的数字
注意:列名是Free_Space和Free_Space__(ssrs显然不喜欢%sign)
这是表达式
=Switch((Fields!Free_Space__.Value >= 20), "Lime", (Fields!Free_Space.Value > 50) AND (Fields!Free_Space__ > 10), "Lime", (Fields!Free_Space.Value > 50) AND (Fields!Free_Space__ < 10), "Orange", (Fields!Free_Space.Value < 50) AND (Fields!Free_Space__ > 10), "Orange", (Fields!Free_Space.Value < 50) AND (Fields!Free_Space__ < 10), "Red")
出于某种原因,当我尝试在SSRS中预览报表时,我收到以下错误:
编译器错误消息:BC30452:运算符&#39;&gt;&#39;未定义
有人能看出我的表情有什么问题吗?我真的不明白我哪里出错了。
谢谢大家。
答案 0 :(得分:1)
你错过了来自!Free_Space__的.Value属性。没有它们,它认为你正在试图比较对象(这个对象大于10?无法分辨)。
请改为尝试:
=Switch((Fields!Free_Space__.Value >= 20), "Lime", _
(Fields!Free_Space.Value > 50) AND (Fields!Free_Space__.Value > 10), "Lime", _
(Fields!Free_Space.Value > 50) AND (Fields!Free_Space__.Value < 10), "Orange", _
(Fields!Free_Space.Value < 50) AND (Fields!Free_Space__.Value > 10), "Orange", _
(Fields!Free_Space.Value < 50) AND (Fields!Free_Space__.Value < 10), "Red")