Reputation: 817
How do I write an SSRS LIKE expression to see if one field contains values in another field? For example if the name in one field is 'Johnson' the name in the second field should also be 'Johnson' and if not then conditional format the color of the field.
Here's code that I have tried so far, which isn't working correctly.
=iif(instr(Fields!JT_Name.Value, "Fields!Base_Name.Value"),"Transparent","Yellow")
Upvotes: 1
Views: 2010
Reputation: 14108
INSTR() function returns an integer specifying the start position of the first occurence of the string.
It returns 0 if the string is not contained.
Try:
=iif(instr(Fields!JT_Name.Value, Fields!Base_Name.Value)=0,"Transparent","Yellow")
Or if you want to apply the yellow color when the string is not contained try:
=iif(instr(Fields!JT_Name.Value, Fields!Base_Name.Value)>0,"Transparent","Yellow")
Let me know if this helps.
Upvotes: 3