EvaluateBooleanExpression

Evaluate Boolean Expression

Major Business Rule

Object Name: B3200480

Parent DLL: CMFG

Location: Client/Server

Language: C

1.Functional Description

1.1Purpose

• This business function reads a boolean expression and returns a "0" if the expression evaluates 
FALSE and "1" if the expression evaluates TRUE.  An error flag is set to "1" if an error is 

encountered during the evaluation of the expression.


1.2Setup Notes and Prerequisites



1.3Special Logic

2.Technical Specifications
2.4Processing 
NOTE:  In the following specification, a "condition" is defined as value + an operator + value
e.g. 0A1 ("false and true"), 1O1 ("true or true"), 1A1 ("true and true").  Some conditions also have 

parentheses around them; some do not.

 

A. Remove blanks from input text string.

B.Process conditions within parentheses:

1)Extract the condition within innermost set of parentheses in the boolean string; this condition 
can be found  immediately to the left of the first right parenthesis.

2)Evaluate the extracted condition using boolean logic (e.g. True AND False evaluates FALSE) to 

either "1" (TRUE) or "0" (FALSE).

3)Replace the condition and the parentheses in the original string with the result of the boolean 

evaluation, e.g. "(1A0)" is replaced with "0".

   Repeat steps 1-3 until no more right parentheses are found. 


C.Process AND conditions Left to Right within the text string:

1)Extract the first AND condition (process left to right) in the boolean string; condition 
includes the value immediately before and after the first "A".

2)Evaluate the extracted condition using boolean logic (e.g. True AND False evaluates FALSE) to 

either "1" (TRUE) or "0" (FALSE).

3)Replace the condition in the original string with the result of the boolean evaluation, e.g. 

"1A0" is replaced with "0".

4)Repeat steps 1-3 until no more AND operators ("A") are found.


D.Process OR conditions Left to Right within the text string:

   1)Extract the first OR condition (process left to right) in the boolean    string; condition 

includes the value immediately before and after the first    "A".

2)Evaluate the extracted condition using boolean logic (e.g. True AND False evaluates FALSE) to 
either "1" (TRUE) or "0" (FALSE).

3)Replace the condition in the original string with the result of the boolean evaluation, e.g. 

"1O1" is replaced with "1".

4)Repeat steps 1-3 until the length of the string is 1; return this character ("1" or "0") in the 

Validation Flag return value.



^

Data Structure

D3200480 - Evaluate Boolean Expression

Parameter NameData ItemData TypeReq/OptI/O/Both
cValidationFlagEV01charNONENONE

An option that specifies the type of processing for an event.

cErrorFlagEV01charNONENONE

An option that specifies the type of processing for an event.

cSuppressErrorMessagesEV01charNONENONE

An option that specifies the type of processing for an event.

szErrorMessageIDDTAIcharNONENONE

A code that identifies and defines a unit of information. It is an alphanumeric code up to 8 characters long that does not allow blanks or 
special characters such as %, &, or +. You create new data items using system codes 55-59. You cannot change the alias.

szBooleanExpressionCF01charOPTNONE

Reserved by J.D. Edwards A string that is generated by concatinating the value of each segment.

Related Functions

None

Related Tables

None