Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

IF condition help - needed

Former Member
0 Likes
850

Hi Folks,

I need 4 different conditions to be checked.

Bottom line :

1. all the conditions are true - No problem

2. all the conditions are false - No problem

3. each condition is true - No probem

4. How do i check more than 1 condition is true?

Regarding 4, I don't want to write 4 x 4 = 16 statements to check each possible cosdition is true or not.

Any simplified solution for this??

Let me know.

Thanks

Matt

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
813

Regarding 3. Do you mean only one condition is true?

6 REPLIES 6
Read only

Former Member
0 Likes
814

Regarding 3. Do you mean only one condition is true?

Read only

0 Likes
813

Nope, more than one contdition is true.

T - True

F - False

FFTT

FTFT

FTTF

FTTT

TFFT

TFTF

TFTT

TTFF

TTFT

TTTF

I want to check the above conditions in single statement??

is there a easy way??? if not in single statement even fewer statement will be better

Any thoughts??

Thanks,

Matt

Read only

0 Likes
813

I don't think you can write a single statement for that.

The simplest thing you can do is:

if condition1 = true.

count = count +1.

if condition2 = true.

count = count +1.

if condition3 = true.

count = count +1.

if condition4 = true.

count = count +1.

if count > 1.

THE CONDITION satisfied.

Read only

former_member194669
Active Contributor
0 Likes
813

Try like this


data : v_all_true type I .
if condition 1 = condition 2.
else.
  v_all_true = v_all_true + 1
endif.
if condition 1 = condition 3.
else.
  v_all_true = v_all_true + 1
endif.
...
...
if v_all_true eq 0
  " all conditions passed
else.
  " all conditions failed
endif

Make of FLAG logic to other condition scenarios also

a®

Read only

0 Likes
813

There is a problem. I didn't explain clearly. mistake is mine.

val1 = A or ' '

val2 = B or ' '

val3 = C or ' '

val4 = D or ' '

I want to check when more than one value of val1, val2, val3 , val4 is not initial. (not each/single value)

That's the problem.

Read only

0 Likes
813

> val1 = A or ' '

> val2 = B or ' '

> val3 = C or ' '

> val4 = D or ' '

> I want to check when more than one value of val1, val2, val3 , val4 is not initial. (not each/single value)

>

I am confused !!!

1. do you have only four variables val1, val2, val3, val4

or

2. or these are in table records ?

Please give your reply with what is your input and what output do you want ?

a®