Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SET ORDER TO issue
Message
From
11/06/2009 11:55:45
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
SET ORDER TO issue
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01405236
Message ID:
01405236
Views:
143
Gang,

Has anyone run into this?

Right or wrong, I have always used the following syntax when setting the ORDER of an index:

SET ORDER TO TagName && Where TagName is the name of the Tag

Or...

SET ORDER TO TAG TagName

Recently we had an error that popped up when an index on a numeric field was deleted. The name of the index was the same as the name of a numeric field in the table. There was no error message and the index was set to the first index. I finally realized, after some head banging that if the TAG doesn’t exist VFP tries to help you out by attempting to EVALUATE the tag name that you supplied. So, in our example since the field evaluated to a valid index number (1), it was using that value as a TAG Number and set the order accordingly. If the number in the field had been greater than the number of index TAGs, in this case > 8, VFP would dutifully return an error saying that the index tag didn’t exist.

The simplest solution to this is to ALWAYS surround TAG Names with quotes as in the following example:

SET ORDER TO “TagName”

Or...

SET ORDER TO TAG “TagName”

Since I have never run into this before I am wondering if this is new behavior in VFP 9?

Is it just me or is the VFP help file wrong on this? Notice that TagName is not prefixed by a lower case “c”. Compare it to cTableAlias.

SET ORDER TO [nIndexNumber | IDXIndexFileName | [TAG] TagName
[OF CDXFileName] [IN nWorkArea | cTableAlias]
[ASCENDING | DESCENDING]]

Thanks,

Steve
Next
Reply
Map
View

Click here to load this message in the networking platform