从数据库检索的数据行如下:
Row | Limit | Color
1 | 0 | Yellow
2 | 50 | Orange
3 | 90 | Green
4 | 100 | Red
创建一个包含两列的表。每列的表达式如下:
第1栏:
=Fields!Color.Value
第2栏:
=Switch(Fields!Row.Value=1, Fields!Limit.Value & " - " & Lookup(2, Fields!Row.Value, Fields!Limit.Value, "LimitDs"), Fields!Row.Value=2, Fields!Limit.Value & " - " & Lookup(3, Fields!Row.Value, Fields!Limit.Value, "LimitDs"), Fields!Row.Value=3, Fields!Limit.Value & " - " & Lookup(4, Fields!Row.Value, Fields!Limit.Value, "LimitDs"), Fields!Row.Value <> 1 and Fields!Row.Value <> 2 and Fields!Row.Value <> 3, ">" & Fields!Limit.Value)
输出如下:
Column 1 | Column 2
Yellow | 0-50
Orange | 50-90
Green | 90-100
Green | 90-100
事实上,我的预期输出如下:
Column 1 | Column 2
Yellow | 0-50
Orange | 50-90
Green | 90-100
Red | >100
任何人都可以提供帮助吗?
答案 0 :(得分:0)
如果您先检查最后一种可能性,其他条件可以表示为一个(Fields!Row.Value + 1):
=IIF(ISNOTHING(Lookup(Fields!Row.Value, Fields!Row.Value, Fields!Limit.Value, "LimitDs")),
">" & Fields!Limit.Value,
Fields!Limit.Value & " - " & Lookup(Fields!Row.Value + 1, Fields!Row.Value, Fields!Limit.Value, "LimitDs"))
答案 1 :(得分:0)
用于第1列的DataSet需要与第2列中的表达式分开:即第1列的DataSet1和第2列中表达式的DataSet 2.第2列的表达式需要修改为以下内容: = Switch(Fields!row.Value = 1,Fields!limit.Value&amp;&#34; - &#34;&amp; Lookup(2,Fields!row.Value,Fields!limit.Value,&#34; DataSet5& #34), Fields!row.Value = 2,Fields!limit.Value&amp; &#34; - &#34; &安培;查找(3,Fields!row.Value,Fields!limit.Value,&#34; DataSet5&#34;), Fields!row.Value = 3,Fields!limit.Value&amp; &#34; - &#34; &安培;查找(4,Fields!row.Value,Fields!limit.Value,&#34; DataSet5&#34;), Fields!row.Value = 4,&#34; &GT; &#34; &安培; Fields!limit.Value)