Microsoft KB Archive/130706

= PRB: MODIFY STRUCTURE Command Doesn't Set Index Order =

Article ID: 130706

Article Last Modified on 2/11/2000

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition

-



This article was previously published under Q130706



SYMPTOMS
When you modify an index by using the MODIFY STRUCTURE command in Visual FoxPro version 3.0, no index order is set.

This behavior appears to be different from that of FoxPro versions 2.x. FoxPro versions 2.x have a Setup dialog box that allows you to modify the table's structure as well as add, modify, delete, or set the index order for the table.



CAUSE
The MODIFY STRUCTURE command in FoxPro versions 2.x and in Visual FoxPro version 3.0 defines the table itself. In Visual FoxPro, the table itself includes the indexes associated with the table. When you modify an index, Visual FoxPro does not assume that this should be the active index. The controlling index is not determined at the table definition level in any version of FoxPro.

When you use the SET command to activate the View window, you are operating on the active workarea. In both FoxPro versions 2.x and in Visual FoxPro, you can set the controlling index at the workarea level.



STATUS
This behavior is by design.



MORE INFORMATION
In FoxPro versions 2.x, the MODIFY STRUCTURE command opens a Table Structure window. This window does not include an option for modifying or setting an index.

In Visual FoxPro version 3.0, the MODIFY STRUCTURE command opens the Table Designer.

The Table Designer includes a tab that allows you to modify the indexes associated with the table. It's easy to confuse this dialog window with the Setup dialog window in FoxPro versions 2.x. However, they are not the same.

In FoxPro versions 2.x, the SET command opens the View window. The View window contains a Setup button that opens a Setup dialog box. On the right side of the Setup dialog box, FoxPro provides a button that allows you to modify the structure of the table. This option opens the same Table Structure window as the MODIFY STRUCTURE command does. On the left side of the Setup dialog box, FoxPro provides an area that allows you to modify indexes and set the active index. This is appropriate because you are setting the controlling index for the table active in a specific workarea.

In Visual FoxPro version 3.0, the SET command also opens the View window. The View window contains a Properties button that opens the WorkArea Properties dialog box, which contains an Index Order button. Click the button to select the controlling index for the table in this workarea.

Steps to Reproduce Behavior
To see the behavior in FoxPro versions 2.x, follow these steps:

  Start FoxPro version 2.x, and type the following commands in the Command window (assuming FoxPro is the main FoxPro directory): USE \FoxPro\language\customer MODIFY STRUCTURE The Table Structure window appears. Note that it contains no options for creating, modifying, or setting an index for the table. Click the Cancel button to close the window.  Type SET in the Command window to see the View window. Click the Setup button. The Setup dialog box appear. In the Structure area of the Setup dialog box, choose the Modify button. The Table Structure dialog box appears. This is the same dialog box that is activated by the MODIFY STRUCTURE command. Click the Cancel button to close the Table Structure dialog box. In the Index area of the Setup dialog box, choose the Modify button. The Index dialog box appears. Select the contact index in the Index Key: list box. Choose the Index Key button to activate the Expression Builder.</li>  In the INDEX ON: text box, add company to contact: contact+company </li> Choose the OK button to save the change, and close the Expression Builder. Choose the OK button to close the Index dialog box. When the "contact already exists, overwrite it" message appears, click the Yes button. You should see a small icon in the shape of a key next to the Customer:Contact index. This indicates that "contact" is the controlling index.</li></ol>

To see the behavior in Visual FoxPro version 3.0, follow these steps:

<ol>  Start Visual FoxPro, and type the following in the Command window (assuming VFP is the main Visual FoxPro directory): USE \vfp\samples\data\customer MODIFY STRUCTURE The Table Designer window appears. </li> Select the Index tab. Then select the Contact index.</li> Click the small button to the right of the Expression list to activate the Expression Builder.</li>  In the Expression text box, add company to contact: contact+company </li> Click the OK button to save the change, and close the Expression Builder. You should see the modified index key in the list.</li> Click the OK button to close the Table Designer. When the "Make structure changes permanent?" message appears, click the Yes button.</li> In the Command window, type SET to bring up the View window. Choose the Properties button. The WorkArea Properties dialog box appears. You can see that no index order is set for this table.</li> Set the controlling index by selecting one of the indexes in the list.</li> Click the OK button to close the WorkArea Properties dialog box. You should see a small arrow to the left of the Customer alias. This arrow indicates that an index order has been set for the table in this workarea.</li></ol>

Additional query words: VFoxWin

Keywords: KB130706

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.