RE:using AND and OR

sean_gilbert

Well Known Member
RE:using AND and OR

Gentlemen,

Here's my two cents...

It seems that the 'OR' only works to seperate groupings of 'AND'
statements...

Zoltan is right in that OneWorld will require a much longer set of
statements...

Following is my OneWorld Data Selection interpretation of your request..
where (((fieldA = value1 or fieldB = value2) and
(fieldC > value3 and fieldD < value4)) or
((fieldA = value5 or fieldB = value6) and
(fieldC > value7 and fieldD < value8)))

OneWorld

Where FieldA = value1
AND FieldC gt value3
AND FieldD lt value4
OR FieldB = value2
AND FieldC gt value3
AND FieldD lt value4
OR FieldA = value5
AND FieldC gt value7
AND FieldD lt value8
OR FieldB = value6
AND FieldC gt value7
AND FieldD lt value8

Hope this makes some kind of sense....

Sean Gilbert
JDEdwards Consultant
PricewaterhouseCoopers
Montreal

Tel: 514.205.5000 x3619
Fax: 450.655.0163
----------------------------------------------------------------
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from any
computer.
 
Hi Sean,

At first, thanks for your two cents.
You are right that "that the 'OR' only works to seperate groupings 'AND' statements..." in OneWorld Selections and IF statements.

It seems to me that your example a bit complicated, so I haven't started to verify it (I suppose, it is surely right).

Let me give a bit simplified Boolean algebra lesson:

Notations will be:
==================
Ar1, Br2, ... means: "A","B" - are any Field or left operand of a relation, 'r' - is any relatinal opreand like "euqual", "greather than" etc., 1,2 - is any value or a right operand of a relation

For example:
Ar1 could be: FC AddressNumber "is less than" 1000
========================
The "rule":
AND and OR logical operands in Boolean algebra works the same way like "multiplication" and "addition" operands in mathematic algebra.
========================
The "target":
We have to decompose complicated logical expression to a "normal form" where relations are groupped by AND operands and these "AND" blocks are concatenated with "OR" operands.
=========================
The basic step to decompose an OR:
(Ar1 OR Br2) AND Cr3
is in normal form (decomposed):
(Ar1 AND Cr3) OR (Br2 AND Cr3)
...like in mathematic:
(A + B) * C = A*C + B*C
=============================
A bit complicated example:
(Ar1 OR Br2) AND (Cr3 OR Dr4)
1st step to decompose:
(Ar1 AND (Cr3 OR Dr4)) OR (Br2 AND (Cr3 OR Dr4))
2nd step and final normal form:
(Ar1 AND Cr3) OR (Ar1 AND Dr4) OR (Br2 AND Cr3) OR (Br2 AND Dr4)
...like in mathematic:
(A + B) * (C + D) = A*C + A*D + B*C + B*D
===========================================
Extension:
You can substitute Ar1,Br2...Dr4 in the examples with any "AND concatenated blocks, like:
((Ar1 AND Br2 AND Cr3) OR Dr4 ) AND Er5
in normal form is:
((Ar1 AND Br2 AND Cr3 AND Er5) OR (Dr4 AND Er5)
...like in mathematic:
((A*B*C) + D) * E = A*B*C*E + D*E
====================================
P.S.: I used the parentheses in the NORMAL FORMs just to indicate the "AND" blocks.
========================

It were my two cents, maybe could be a some of help for somebody,

Zoltán


B7332 SP11, ESU 4116422, Intel NT4, SQL 7 SP1
(working with B7321, B7331, XE too)
 
Back
Top