How to: Specify a Sort Order
You can specify a sort order for character fields used in subsequent indexing and sorting operations.
To specify a sort order
From the Tools menu, choose Options.
Select the Data tab.
In the Collating sequence box, select the appropriate sort order.
To save this setting for future sessions of Visual FoxPro, choose Set as Default.
Tip
You can also specify a sort order with the SET COLLATE TO command or the COLLATE statement in your Config.fpw file. For details about Config.fpw, see Customizing the Visual FoxPro Environment.
The current sort order doesn't affect previously created indexes; however, it does affect the results of comparisons and commands such as SEEK and SELECT - SQL.
You can change the sort order at any time. For instance, after opening a customer table you can create index tags representing different sort orders, as shown in the following code. Then you can change the sort order by simply using a different tag:
USE customer
SET COLLATE TO "GENERAL"
INDEX ON fname TAG mygeneral ADDITIVE
SET COLLATE TO "MACHINE"
INDEX ON custid TAG mymachine ADDITIVE
SET COLLATE TO "DUTCH"
INDEX ON lname TAG mydutch ADDITIVE
Note
The sort order for an index overrides the current sort order.
The current code page determines which sort orders are available. If you use the SET COLLATE Command to specify a sort order not supported by the current code page, Visual FoxPro generates an error. Also, if you specify a sort order in Config.fpw that isn't supported by the current code page, the sort order defaults to Machine.
See Also
Concepts
Application Creation with Double-Byte Character Sets
Sorting Data in International Applications
Reference
Code Pages Supported by Visual FoxPro