IIF(InStr) function - Inserting data into unrelated field

snejsnej picture snejsnej · Mar 31, 2015 · Viewed 14.6k times · Source

I have the following expression in a report field (Report Builder 1.0):

=IIf(InStr(Fields!AMA_WEBUSERID.Value,"support") > 0, Fields!Centre.Value = "Web", Fields!Centre.Value)

The expression evaluates to True, but another field (Centre) is not filled with the string Web. Instead it just says False.

Answer

Chris Latta picture Chris Latta · Mar 31, 2015

You are getting False because the when AMA_WEBUSERID contains "support" you evaluate the Boolean expression Fields!Centre.Value = "Web" which returns False. You can't assign the value of a field in the way you are trying to. Instead, use the following formula for the Value property of the cell where you are displaying the field Centre:

=IIf(InStr(Fields!AMA_WEBUSERID.Value,"support") > 0, "Web", Fields!Centre.Value)