[英]SSRS nested IIF/CStr explanation
Could someone let me know if the IIF statement below means output any value that starts with a 4 please? 有人可以让我知道下面的IIF语句是否意味着输出任何以4开头的值?
=IIF(LEFT(CStr(Fields!CLOCK_NUMBER.Value),1)="4",Fields!JOB_NO.Value, "") = IIF(LEFT(CStr(Fields!CLOCK_NUMBER.Value),1)=“ 4”,Fields!JOB_NO.Value,“”)
The short answer is yes. 简短的答案是肯定的。
Starting from the middle and working outwards this expression is doing the following.. 从中间开始,向外进行此表达式,以进行以下操作。
If this is not working for some reason, try converting the job_no to a string before returning, that way you ensure you always return a string (in case JOB_NO is numeric). 如果由于某种原因该方法不起作用,请尝试在返回之前将job_no转换为字符串,以确保始终返回字符串(以防JOB_NO为数字)。 You can simply wrap the job_no in a CSTR like this
CSTR(Fields!JOB_NO.Value)
您可以简单地将job_no包装在这样的
CSTR(Fields!JOB_NO.Value)
Translates to..."try to" convert the field CLOCK_NUMBERS's
native value to a string and take the LEFT(1) most significant digit(s) and if that value is "4" then return the JOB_NO
Fields's value. 转换为...“尝试”以将
CLOCK_NUMBERS's
字段CLOCK_NUMBERS's
本机值转换为字符串,并使用LEFT(1)的最高有效数字,如果该值为“ 4”,则返回JOB_NO
字段的值。 else return empty string. 否则返回空字符串。
So, it is, if the first digit is 4 then return JOB_NO
. 因此,如果第一个数字为4,则返回
JOB_NO
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.