Please enable JavaScript to view this site.

R:BASE 11 Help

Navigation: Function Index > I

IFF

Scroll Prev Top Next More

(IFF((condition),arg1,arg2))

 

If the condition is met, then the value of arg1 is returned. If condition is not met, then the value of arg2 is returned.

 

The condition must follow the syntax specifications as set with IF...ENDIF command structure.

 

The condition must list a set of conditions that combine to form a statement that is either true or false. Conditions can be combined with the connecting operators AND, OR, AND NOT, and OR NOT. It is important to note that the condition needs to be a single item, which is why quotes are used in the examples below.

 

The data types of arg1 and arg2 must match.

 

Examples:

 

-- Example 01:

- -Comparison of Variables

SET VAR v1 INTEGER = 1

SET VAR v2 INTEGER = 2

SET VAR v3 = (IFF('.v1<.v2','First','Second'))

SHOW VAR v3

First

 

-- Example 02:

-- SELECT and Display Feedback on Data

 

CONNECT RRBYW20

R>SELECT NetAmount,(IFF('NetAmount>$100000','Good','Needs Improvement'))=30 AS Status FROM SalesBonus

 

NetAmount       Status                        

--------------- ------------------------------

    $176,000.00 Good

     $87,500.00 Needs Improvement

     $22,500.00 Needs Improvement

     $40,500.00 Needs Improvement

     $76,800.00 Needs Improvement

     $36,625.00 Needs Improvement

     $56,250.00 Needs Improvement

    $152,250.00 Good

    $108,750.00 Good

     $78,750.00 Needs Improvement

     $27,000.00 Needs Improvement

      $9,500.00 Needs Improvement

    $210,625.00 Good