Can someone help:
CASE WHEN ISNULL(pr.[isDefunct], 0) = 1 THEN 0 WHEN ISNULL(pr.[isCancelled], 0) = 1 THEN 0 WHEN ISNULL(ab.IsEscorted, 0) = 0 THEN 0 WHEN bc.Movement <> 'CR Movement' THEN 0 WHEN bc.LocationType <> 'Bank' THEN 0 WHEN ISNULL(bc.DateTime, @NullDate) <> @NullDate THEN 0 ELSE 1 END
Discussion posts and replies are publicly visible
You could use a Decision object. This allows you to pass in multiple parameters and then apply the tests you have expressed in your WHEN statements. You can enforce strict order in a Decision (i.e. the first row that evaluates to true returns the result) and it also includes an ELSE which would fulfil your last requirement.