0

I'm working on a report that is trying to display a simple "True" when the contents of a field is SOMEWHERE within another.

Right now I'm using for the expression:

=IIF(Fields!Medicaid___from_Prestige.Value.Contains("Fields!Medicaid___from_PML.Value"),"TRUE","FALSE")

And I'm still getting False on the report. See the picture: enter image description here enter image description here

dragos_kai
  • 163
  • 4
  • 18
  • Possible duplicate of [Using 'like' in ssrs expressions](https://stackoverflow.com/questions/9009825/using-like-in-ssrs-expressions) – Scath Oct 10 '17 at 18:26
  • Most people here want formatted text, not images. – jarlh Oct 10 '17 at 18:41

2 Answers2

2

Try contains ex:

=IIF(Fields!Medicaid___from_Prestige.Value.ToLowerInvariant(‌​).Contains(Fields!Medicaid___fro‌​m_PML.Value),"TRUE","FALSE")

EDIT: Index of

=IIF(Fields!Medicaid___from_Prestige.Value.ToLowerInvariant(‌​).IndexOf(Fields!Medicaid___fro‌​m_PML.Value),"TRUE","FALSE")
Scath
  • 3,777
  • 10
  • 29
  • 40
  • You're right, I did =IIF(InStr(Fields!Medicaid___from_Prestige.Value.Contains("Fields!Medicaid___from_PML.Value"),"TRUE","FALSE") and for some reason contains is triggering the red line of doom. – dragos_kai Oct 10 '17 at 18:20
  • try removing the instr? I forgot to do that from my answer before I edited – Scath Oct 10 '17 at 18:21
  • Overload resolution failed because no accessible 'IIF' accepts this number of arguments. – dragos_kai Oct 10 '17 at 18:22
  • I just found an example using index of I don't know if it works but marking this as duplicated because it is another SO question – Scath Oct 10 '17 at 18:26
  • https://stackoverflow.com/questions/9009825/using-like-in-ssrs-expressions – Scath Oct 10 '17 at 18:27
  • Now I'm getting "true" on everything. – dragos_kai Oct 10 '17 at 18:31
  • Did you switch the IndexOf("Your actual column value") – Scath Oct 10 '17 at 18:33
  • Yes I did. It's returning true now regardless if it exists or not. – dragos_kai Oct 10 '17 at 18:36
  • Still giving you the answer, but I modified a bit from that SO that you linked. =IIF(Fields!Medicaid___from_Prestige.Value.ToLowerInvariant().Contains(Fields!Medicaid___from_PML.Value),"TRUE","FALSE") – dragos_kai Oct 10 '17 at 18:41
1

I did the following, and it worked:

=IIF(Fields!Medicaid___from_Prestige.Value.ToLowerInvariant().Contains(Fields!Medicaid___from_PML.Value),"TRUE","FALSE")
dragos_kai
  • 163
  • 4
  • 18