Using 'like' in ssrs expressions

[亡魂溺海] 提交于 2019-11-27 22:52:53
Oleg Dok

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")

It is like in access: not '%' but '*':

=Fields!Notes.Value Like "*deadline*"

"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") 

Why not use something like:

Fields!Notes.Value.Contains("deadline") 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!