Finding the Maximum or Minimum Value by Alphabetic Order

ID: Q115420

The information in this article applies to:

SUMMARY

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

MORE INFORMATION

Method 1: Calculation

   CALCULATE MAX(<char_field>) TO <variable_name>

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 <char_field> TAG <tag_name> OF <index_name>
   SET ORDER TO <tag_name>
   ***To obtain the lowest letter record value, do the following:
   GO BOTTOM
   <variable_name>=<char_field>
   ***To obtain the highest letter record value, do the following:
   GO TOP
   <variable_name>=<char_field>

Method 3: Indexing/LOCATE

   INDEX ON <char_field> TAG <tag_name> OF <index_name>
   ***To obtain the highest letter record value, do the following:
   SET ORDER TO <tag_name> ASCENDING
   LOCATE
   <variable_name>=<char_field>
   ***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

Last Reviewed: June 27, 1995