I'm trying to highlight a field when the value has the word 'deadline' in it. I'm trying to use the expression:
=IIf(Fields!Notes.Value like "%deadline%","Yellow","Transparent")
in the BackgroundColor property.
It's not highlighting the field (not changing the background color). The 'Notes' field is a text datatype and I'm using Report Builder 3.0 if that makes a difference. What am I doing wrong?
就像在访问中:不是 '%' 而是 '*':
=Fields!Notes.Value Like "*deadline*"
SSRS does NOT use SQL syntax, but instead uses Visual Basic.
Use something like this:
=IIf(Fields!Notes.Value.IndexOf("deadline") >= 0,"Yellow","Transparent")
Or .Contains instead of .IndexOf
=IIf(Fields!Notes.Value.ToLowerInvariant().Contains("deadline"),"Yellow","Transparent")
"InStr" works for me:
=IIF(InStr(Fields!Notes.Value,"deadline")>0, "Yellow", "Transparent")
Remember that the compare value is case-sentive, so maybe use UCASE around:
=IIF(InStr(UCASE(Fields!Notes.Value),"DEADLINE"))>0, "Yellow", "Transparent")
为什么不使用类似的东西:
Fields!Notes.Value.Contains("deadline")
It is case-sensitive. FYI. Use with lowercase - =IIf(LCase(Fields!Notes.Value) Like "*deadline*","Yellow","Transparent")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.