cancel
Showing results for 
Search instead for 
Did you mean: 

if...then...else formula

Former Member
0 Kudos

Hi,

I have three characteristic fields in my query. I want to create a formula that will display the value in either field1 or field2 based on a value in field3. Example:

if field 3 = Yes then

display value in field1

else

display value in field2

end if

How do I do that?

Thanks,

MIG

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Right click on the Structure and select "Create New Formula". In the next page different functions will be listed. Select your conditional field (In your case Field 3) and use the logical expressions listed (Like Greater than or equal to >=, lesser than or equal to <= etc.,) Use your logic in creating the formula and thats it, you are done...

Regards,

Kishore

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

You can use the below formula.

( V == 1 ) * ( M ) + ( V ==2 ) * ( Y )

Here * means "THEN" '+' Means Else

Regards,

Malli

Former Member
0 Kudos

Really appreciate your help everyone. Thanks.

Former Member
0 Kudos

Hi MIG,

In bex there is no direct if then else functionality but you can use boolean function to full fill your requirement.

in your example

use formula like this

(field 3 = yes )* field1 + ( field 3 <> yes) * field 2.

Here booloen opereator return value 1 if condition met otherwise it returns 0.

Hope you understood.

Regards,

Vijay.

Former Member
0 Kudos

MIG,

Could you please give more details along with sample data. Your requirement is not clear.