问题描述
我有一个使用多个IIF的表达式,但是由于某种原因,每条记录在该列中均被列为“免疫”,也许我在此查询中可能做错了什么。非常感谢您为解决此问题所提供的帮助
=IIF(Fields!CompliantWith.Value like "*Declin*","Valid Declination - " & IIF(Fields!DeclinationValue.Value <> nothing,Fields!DeclinationValue.Value,"Not Specified"),IIF(Fields!CompliantWith.Value like "*Contraindication*","Medical Contraindication - " & IIF(Fields!ContraindicationValue.Value <> nothing,Fields!ContraindicationValue.Value,IIF(Fields!CompliantWith.Value like "*ExemP*","Valid Exemption - " & IIF(Fields!ExemptionValue.Value <> nothing,Fields!ExemptionValue.Value,IIF(Fields!CompliantWith.Value like "*Immunize*","Immunized",""))))
解决方法
尝试将like
替换为.Contains
,然后删除*。
据我所知,SSRS表达式不直接支持像。
所以这个
Fields!CompliantWith.Value like "*Declin*"
会成为这个
Fields!CompliantWith.Value.Contains("Declin")
对于这样的情况,您可能还想考虑使用= SWITCH,它比嵌套的IIF更容易阅读