Release 10.1A: OpenEdge Development:
Progress 4GL Reference

> ## MINIMUM function

> Compares two or more values and returns the smallest.

> #### Syntax

>     MINIMUM ( expression , expression [ , expression ] ... )

> ``expression``

> A constant, field name, variable name, or expression. If there is a mixture of decimal and integer data types, decimal type is returned.

> Example

> This procedure prompts the user for an item number and how many of the item they want. If the number of items a user wants (stored in the want variable) is the minimum of the want variable and the on-hand field, the procedure displays an “enough in stock” message. Otherwise, the procedure displays a “not enough in stock” message.

> r-minmum.p
>     DEFINE VARIABLE want LIKE on-hand LABEL "How many do you want?".
>     DEFINE VARIABLE ans AS LOGICAL.

>     REPEAT:
>         PROMPT-FOR item.item-num want.
>         FIND item USING item-num.
>         ans = no.
>         IF MINIMUM(INPUT want,on-hand) = INPUT want
>         THEN DO:
>             MESSAGE "We have enough" item-name "in stock.".
>             MESSAGE "Any other items to check?" UPDATE ans.
>             IF NOT ans THEN LEAVE.
>         END.
>         ELSE DO:
>             MESSAGE "We only have" on-hand item-name "in stock.".
>             MESSAGE "Any other items to check?"
>             UPDATE ans.
>             IF NOT ans THEN LEAVE.
>        END.
>     END.

> #### Notes

> - When comparing character values, if at least one of the character fields is defined as case sensitive, then MINIMUM treats all of the values as case sensitive for the sake of the comparisons. If none of the values is case sensitive, MINIMUM treats lowercase letters as if they were uppercase letters.

> - You can use MINIMUM to compare DATE, DATETIME, and DATETIME-TZ data. The data type that contains less information (that is, a DATE value contains less information than a DATETIME value, and a DATETIME value contains less information than a DATETIME-TZ value) is converted to the data type with more information by setting the time value to midnight, and the time zone value to the session's time zone (when the data type does not contain the time or time zone). Comparisons with DATETIME-TZ data are based on Coordinated Universal Time (UTC) date and time.

> #### See also

> MAXIMUM function

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