Using Primary Logical Operators in Formulae

Article No

Q0006

Version Applicability

PERKS 2.45 and later

Last Reviewed On

April 27, 2000

SYMPTOM:

The primary Logical Operators being used to join conditions in Formulae are the Grouping Operator: () and Logical ‘AND’, ‘OR’, ‘NOT’ and indeed, ‘EQUAL TO’.

Let us consider the use of these Operators in terms of a scenario. This is as follows.

Assume that a benefit named ‘Child Relief’ is available conditionally. To indicate if an employee is elected to receive this benefit, a Logical field is required. Let us call it ‘ECR’ (‘Elected for Child Relief’). It can be an ‘Employee Other Information’ field.

  1. For Single male or female, return value of: 1

  2. For Married female and not elected for child relief, return a value of: 1

  3. For Married male and elected for child relief, return value of: 1

  4. Other wise, return value: 0.

RESOLUTION:

While the use of Logical AND, OR and NOT Operator is known to most of us, it may be mentioned in this context that the default precedence of ‘AND’ Operator is higher than ‘OR’, and that of ‘NOT’ is lowest. To overcome this default precedence, we need to use Grouping Operator.

MARRIED, FEMALE and MALE are logical variables supplied by the System that we can use to identify the sex and marital status.

The following formula serves our purpose:

IIFN(SINGLE OR (MARRIED AND FEMALE AND NOT ECR) OR (MARRIED AND MALE AND ECR),1,0 )

MORE INFORMATION:

In this context, it may be mentioned that a logical expression like <Cond1> OR <Cond2> AND <Cond3> by the default order of precedence, is evaluated as under:

<Cond1> OR (<Cond2> AND <Cond3>)

In fact in this case, if <Cond1> is found to be TRUE, the System would not proceed to evaluate other conditions. This is the standard behaviour of the platform. To alter this behaviour, and for better readability, we use the Grouping Operator ‘()’.

Refer to the Online Help and search for ‘Formula Builder’ for obtaining more information on the ‘IIFN()’ function.


 
 

Disclaimer:
The information provided in the list of Knowledge-Base Articles are provided on an As-Is basis without warranty of any kind, either expressed or implied, including warranties of merchantability and fitness for a particular purpose. In noevents shall FACT Software International Pte Ltd or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if FACT Software International Pte Ltd or its suppliers have been advised of the possibility of such damages. The names of actual companies and products mentioned herein may be the trademarks of their respective owners. All third party trademarks are the property of their respective owners.

Copyright © 2010 FACT Software International Pte Ltd