Hi Giri,
a condition is 1 if it's true, otherwise 0. In your example:
if content of A = 0, the condition is true (equal 1) and the result will be (1*1+0)*(B-C) = B-C.
if content of A <> 0, the condition is false (equal 0) and the result will be (0*1+0)*(B-C) = 0.
You can have the same result with the following formula: (A==0) * (B-C).
In general, if-then-else is made in Bex in this way:
if A = x then B elseif A = y then C else D
in Bex
(A==x)*B + (A==y)*C + (A<>x * A<>y)*D
Best regards,
Antonio
Hi,
Antonio's explanation above is correct.
You can just use his formula.
(A==0) * (B-C)
But sometimes having multiple elements.
So what you can do is store first the B-C in a FORMULA.
TEST_FORMULA = B - C
Then apply it to your condition formula.
(A==0) * TEST_FORMULA
Regards,
Loed
Add comment