David,

I am new to JDE but I understand a little Boolean logic. Assuming Zoltan is

correct and AND takes precedence over OR, you could rework your origninal

expression:

"where (((fieldA = value1 or fieldB = value2) and

(fieldC > value3 and fieldD < value4)) or

((fieldA = value5 or fieldB = value6) and

(fieldC > value7 and fieldD < value8)))"

Let P = "fieldA = value1"

Q = "fieldB = value2"

R = "fieldC > value3"

S = "fieldD < value4"

T = "fieldA = value5"

U = "fieldB = value6"

V = "fieldC > value7"

W = "fieldD < value8"

Then your expression can be rewritten as:

where (((P or Q) and (R and S)) OR ((T or U) and (V and W)))

Now (P or Q) and (R and S) can be rewritten (P and R and S) or (Q and R and

S).

Likwise (T or U) and (V and W) can be rewritten (T and V and W) or (U and V

and W).

Now (((P or Q) and (R and S)) or ((T or U) and (V and W))) = ((P and R and

S) or (Q and R and S)) or ((T and V and W) or (U and V and W))

= (P and R and S) or (Q and R and S) or (T and V and W) or (U and V and W).

Now we substitute back:

(P and R and S) or

(Q and R and S) or

(T and V and W) or

(U and V and W) =

(fieldA = value1 and fieldC > value3 and fieldD < value4) or

(fieldB = value2 and fieldC > value3 and fieldD < value4) or

(fieldA = value5 and fieldC > value7 and fieldD < value8) or

(fieldB = value6 and fieldC > value7 and fieldD < value8).

Assuming that the AND takes precedence over the OR, the parens can be

removed to yield:

fieldA = value1 and fieldC > value3 and fieldD < value4 or

fieldB = value2 and fieldC > value3 and fieldD < value4 or

fieldA = value5 and fieldC > value7 and fieldD < value8 or

fieldB = value6 and fieldC > value7 and fieldD < value8.

Assuming AND takes precedence over the OR, now we have an equivalent

expression to your initial expression with no parens.

I think this is correct but please set up a truth table to check the

validity of my results. Hope this help.

Regards,

Pat

----- Original Message -----

From: Zoltan_Gyimesi <zoltan.gyimesi@synergon.hu>

To: <jdeowdevml@jdelist.com>

Sent: Thursday, May 03, 2001 10:18 AM

Subject: Re: using AND and OR

can not use parentheses.

an AND/OR normal form keeping these rules in view.

http://198.144.193.139/cgi-bin/wwwthreads/showflat.pl?Cat=&Board=OWDEV&Numbe
r=10178

Patrick Plusnick

OneWorld/XE SP 14.2, ES AS/400, DS NT 4, JAS NT 4