8

我想编写一个"Expression"基本上表现为以下行为的报告服务(伪代码)......

if ([Fields!StateProvinceId.Value] == 1)
{
   return "Ontario";
}
else if ([Fields!StateProvinceId.Value] == 2)
{
   return "Quebec";
}
else if ([Fields!StateProvinceId.Value] == 3)
{
   return "Manitoba";
}
// ...
// more cases same pattern

我没有看到这种类型的逻辑我必须嵌套一堆 IIF 吗?

=IIF(Fields!StateProvinceId.Value = 1, "Ontario", IIF(Fields!StateProvinceId.Value = 2, "Quebec", IFF(Fields!StateProvinceId.Value = 3, "Manitoba", "Unknown Province")))
4

1 回答 1

16

您是否尝试过 switch 语句?

= Switch( Fields!StateProvinceId.value=1,"Ontario", Fields!StateProvinceId.value=2,"Quebec", Fields!StateProvinceId.value=3,"Manitoba")

请参阅此页面上的“决策功能”,例如:

http://msdn.microsoft.com/en-us/library/ms157328.aspx

于 2010-08-23T21:59:25.333 回答