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 OnHand 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 NO-UNDO LIKE on-hand LABEL "How many do you want?".
DEFINE VARIABLE ans  AS LOGICAL NO-UNDO.

REPEAT:
  PROMPT-FOR Item.ItemNum want.
  FIND Item NO-LOCK USING Item.ItemNum.
  ans = FALSE.
  IF MINIMUM(INPUT want, Item.OnHand) = INPUT want THEN DO:
    MESSAGE "We have enough" Item.ItemName "in stock.".
    MESSAGE "Any other items to check?" UPDATE ans.
    IF NOT ans THEN LEAVE.
  END.
  ELSE DO:
    MESSAGE "We only have" Item.OnHand Item.ItemName "in stock.".
    MESSAGE "Any other items to check?"
    UPDATE ans.
    IF NOT ans THEN LEAVE.
  END.
END.

Notes

See also

MAXIMUM function