1

是否有一种简单的方法可以在 SSRS 公式中执行 IN 语句或类似的操作以进行 iff 语句比较,而无需重复切换 16 次?

这就是我希望在不必Fields!FieldName.Value = "01" OR Fields!FieldName.Value = "02"为每个值编写语句或单独的 OR ie( ...etc) 的情况下完成的任务:

=iif((Fields!FieldName.Value IN
("01","02","03","06","08","09","10","12","15","19"),"TypeA",
iff((Fields!ProdCode.Value IN ("04","07","11","13","14","16"),
"TypeB","TypeC")
4

3 回答 3

2

或这个:

=switch( 
Instr( "," & "01,02,03,06,08,09,10,12,15,19" & ",", "," & Fields!FieldName.Value & ",") > 0  ,"TypeA",
Instr( "," & "04,07,11,13,14,16" & ",", "," & Fields!ProdCode.Value & ",") > 0  ,"TypeB",
True, "TypeC")
于 2016-07-11T22:33:07.323 回答
0

试试这个:

=Switch(
Array.IndexOf(Split("01,02,03,06,08,09,10,12,15,19",","), Fields!FieldName.Value)>-1,"TypeA",
Array.IndexOf(Split("04,07,11,13,14,16",","),Fields!FieldName.Value)>-1,"TypeB",
true,"TypeC"
)

让我知道这是否有帮助。

于 2016-07-11T22:26:59.997 回答
0

我已经模拟了一个连接到在 sql 中生成的表的示例。这比在报告中做更有效率

SELECT a,b,c,d, etc
, Lookup.FieldName, Lookup.TypeLabel
FROM Tables INNER JOIN 
(SELECT '01' AS FieldName, "TypeA" as TypeLabel
UNION ALL
SELECT '02' , "TypeA"
UNION ALL
SELECT '03' , "TypeA"
UNION ALL
SELECT '04' , "TypeB"
UNION ALL
...

SELECT '18' , "TypeC"
UNION ALL
SELECT '19' , "TypeC") LookUp 
ON Tables.FieldName = Lookup.FieldName
于 2016-07-11T22:32:03.040 回答