In SQL server reporting services(SSRS) tablix cell, i want to write an expression as follows:-
set the value of variable and use that variable in "if" condition. i have written following expression and its working fine, only issue is i want only "if" condition to be evaluate. currently output is : "TrueVariable text is NA"
=Variables!myVar.SetValue("NA") &IIf(Variables!myVar.Value="NA","Variable text is NA","Variable text is not NA")
The result you get is because you are concatenating both expressions, the assignment and the conditional. The assignment returns "True" and the conditional "Variable text is NA" therefore the result is "TrueVariable text is NA"
if you want just the result of the conditional you can for example wrap the assignment inside an IIF, and as it always will be true, then you can do something like this
=IIF(Variables!myVar.SetValue("NA"),
(IIf(Variables!myVar.Value="NA","Variable text is NA","Variable text is not NA"), "should never get here"
)