Progress
Report Builder
User’s Guide


CASE

Returns one of several possible results based on the value of an expression. You can use CASE instead of a nested IIF expression to return results conditionally when there are more than two possibilities. This function selects only on the basis of equality.

SYNTAX

CASE ( expression , when-value-a , return-value-a ,
        when-value-b , return-value-b , ... ,
        default-return-value
     ) 

expression

The expression that determines which value to return. The expression can be any valid Progress expression. It can include comparisons, logical operations, and parentheses.

when-value-a , when-value-b ...

An expression that evaluates to a possible value for expression. If when-value-n matches the current value of expression, then Report Builder returns the corresponding return-value. All when-values must be of the same data type as expression.

return-value-a , return-value-b ...

The value that Report Builder returns if the corresponding when-value-n equals the expression. All return values must be of the same data type, which might be different from the data type of the expression.

default-return-value

The value the Report Builder returns if the expression is not equal to any when-value-n. The default-return-value must be of the same data type as the other return-values. All return values must be of the same data type, which might be different from the data type of the expression.

NOTE

You can use memo fields as return-value-n, but not as test values.

EXAMPLE

To assign different strings based on the item number (Item-num), create the expression:

CASE(Item-Num, 1,"Fins", 2, "Tennis Racquet", 3, "Sweatband", - ") 

This CASE expression is simpler than but equivalent to the following nested IIF expression:

IIF(Item-num = 1, "Fins",
  IIF(Item-num = 2, "Tennis Racquet",
     IIF(Item-num = 3, "Sweatband", " "))) 


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095