cancel
Showing results for 
Search instead for 
Did you mean: 

If/Else/Then statement in Bex

Former Member
0 Kudos

Hi all,

I want to create some conditional logic in Bex formula. The logic I need is:

IF (KeyFigA exists) THEN (use KeyFigA) ELSE IF (KeyFigB exists) THEN (use KeyFigB) ELSE (use KeyFigC)

I am a bit confused on the operators I need to use...Can anyone help?

Thanks

CM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Courtney,

It depends on what you mean by "EXISTS" here. If it means that the value is <> 0, then the logic would be:

( KFA .NE. 0 ) * KFA + (KFA == 0 ) * (KFB .NE. 0 ) * KFB + ( KFA == 0 ) * ( KFB == 0 ) * KFC

Note: ".NE." above will actually be a < followed by >, but this silly editor doesn't like those characters.

Hope this helps...

Bob

Former Member
0 Kudos

Hi,

( KFA <> 0 ) * KFA + (KFA == 0 ) * (KFB <> 0 ) * KFB + ( KFA == 0 ) * ( KFB == 0 ) * KFC

Just as Bob said, however, you need to use the <> symbols for .NE.. You can also select the symbols in the Boolean Logic section.

Brian

I think I know why Bob added the .NE., even though I can see them in my edit screen, they are not showing up in the message after I save it.

Edited by: Brian Anthony on Oct 20, 2008 4:39 PM

Answers (1)

Answers (1)

Former Member
0 Kudos

This works perfectly. Thank you!