Microsoft KB Archive/115420

{| = Finding the Maximum or Minimum Value by Alphabetic Order =
 * width="100%"|

ID: Q115420

The information in this article applies to:


 * Microsoft FoxPro for Windows, versions 2.5x, 2.6, 2.6a
 * Microsoft FoxPro for MS-DOS, versions 2.0, 2.5x, 2.6, 2.6a
 * Microsoft FoxPro for Macintosh, versions 2.5b, 2.5c

SUMMARY
This article shows three methods for finding the minimum or maximum value by alphabetic order in a field.

Method 1: Calculation
CALCULATE MAX() TO  The variable now contains the lowest letter record value. For example, ZZZZZ versus BBBBB. NOTE: To get the highest letter record value, replace MAX with MIN.

Method 2: Indexing
INDEX ON  TAG  OF  SET ORDER TO  ***To obtain the lowest letter record value, do the following: GO BOTTOM = ***To obtain the highest letter record value, do the following: GO TOP =

Method 3: Indexing/LOCATE
INDEX ON  TAG  OF  ***To obtain the highest letter record value, do the following: SET ORDER TO  ASCENDING LOCATE = ***To obtain the lowest letter record value do, the following: SET ORDER TO <tag_name> DESCENDING LOCATE <variable_name>=<char_field> Additional reference words: FoxMac FoxDos FoxWin 2.00 2.50 2.50a 2.50b 2.60 2.50c phonetic ASCII first last 2.60a KBCategory: kbprg kbcode KBSubcategory: FxprgGeneral
 * }