Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
If statement 嵌套If语句SSRS表达式_If Statement_Reporting Services_Expression_Ssrs 2012 - Fatal编程技术网

If statement 嵌套If语句SSRS表达式

If statement 嵌套If语句SSRS表达式,if-statement,reporting-services,expression,ssrs-2012,If Statement,Reporting Services,Expression,Ssrs 2012,构建报告并根据某些变量更改颜色。如果这是一个休息的学期,那么把颜色改成“Gainsboro”。如果出席人数小于0.4且不为空,则将颜色改为“#ffc7ce” 我完全搞不懂为什么这段代码不能运行,它看起来很简单 =IIF(fields!Break_Semester <> "Break Semester" ,IIF(len(Fields!Attendance.Value) <> 0 and Fields!Attendance.Value < 0.4

构建报告并根据某些变量更改颜色。如果这是一个休息的学期,那么把颜色改成“Gainsboro”。如果出席人数小于0.4且不为空,则将颜色改为“#ffc7ce”

我完全搞不懂为什么这段代码不能运行,它看起来很简单

=IIF(fields!Break_Semester <> "Break Semester"
    ,IIF(len(Fields!Attendance.Value) <> 0 and Fields!Attendance.Value < 0.4 
        ,"#ffc7ce"
    ,"Gainsboro")
,"Gainsboro")
=IIF(字段!中断\u学期“中断学期”
,IIF(len(Fields!attention.Value)0和Fields!attention.Value<0.4
“#ffc7ce”
“Gainsboro”)
“Gainsboro”)
运行以下命令时,代码将起作用:

=IIF(len(Fields!Attendance.Value) <> 0 and Fields!Attendance.Value < 0.4 
    ,"#ffc7ce"
,"Gainsboro")
=IIF(len(Fields!attention.Value)0和Fields!attention.Value<0.4
“#ffc7ce”
“Gainsboro”)
所以我不知道为什么嵌套会把它搞砸


有什么提示吗?

我相信您只是错误地识别了
Break\u seurm
字段。确保
字段
部分大写,并且需要添加
.Value
。应该如此

=IIF(Fields!Break_Semester.Value <> "Break Semester"
,IIF(len(Fields!Attendance.Value) <> 0 and Fields!Attendance.Value < 0.4 
    ,"#ffc7ce"
    ,"Gainsboro")
,"Gainsboro")
=IIF(字段!Break\u seurm.Value“Break seurm”
,IIF(len(Fields!attention.Value)0和Fields!attention.Value<0.4
“#ffc7ce”
“Gainsboro”)
“Gainsboro”)

也可以在条件语句周围添加括号,但这只是个人的喜好,可以让事情更干净。

谢谢!我觉得我又回到了高中,愚蠢的问题。我最终不需要一个嵌套的IF,只使用了
=IIF(len(Fields!attention.Value)0和Fields!attention.Value<0.4和Fields!Break_serm.Value“Break serm”,“#ffc7ce”,“Gainsboro”)