If A Not Equal to B in SSRS
21,937
Solution 1
The <>
may not work if your values contain NULL
so you may have to run a multiple case comparison such as:
IiF(A<>B OR A IsNothing OR B IsNothing, "C", "D")
Solution 2
This Code will work for you :
=IIF(Not A = B,"D","C")
Author by
UpwardD
Updated on June 13, 2020Comments
-
UpwardD almost 4 years
I understand IIF very well but I am trying to write an expression like the below in SSRS.
IF A<>B,"D" =IIF(A <> B,"C","D") -- this doesn't work for me
What replaces the sign, "<>" in the expression?
-
JC Ford almost 9 years
<>
is the "not equal" comparison operator in VB (the language of SSRS expressions) Can you elaborate on what you're trying to do that isn't working?
-
-
JC Ford almost 9 yearsThis isn't true in the VB.NET world.
Nothing
gets converted to whatever type it's being compared to, soNothing = ""
would evaluate toTrue
as wouldNothing = Nothing
. -
SQLHound almost 9 yearsAnd I agree with you completely, but SSRS sometimes plays by its own rules (this assessment based on experience and not documented instances).