PRB: INDEX ON with Variable Length Tag May Behave Differently (165068)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 5.0
- Microsoft Visual FoxPro for Windows 5.0a
This article was previously published under Q165068 SYMPTOMS
When attempting to create a variable length index tag in Visual FoxPro
version 5.0, one of the following error messages may occur:
Cannot access characters beyond string
Invalid key length
This behavior does not occur in earlier versions of FoxPro.
According to the Visual FoxPro online Help, variable length index keys are
not supported in Visual FoxPro. As stated in the Help file:
If you attempt to build an index with a key that varies in length,
the key will be padded with spaces. Variable-length index keys
aren't supported in Visual FoxPro.
In the case of Visual FoxPro 5.0, it appears that any variable length key
is not being padded.
RESOLUTION
The following code creates an index tag from a variable length key but is
padded to a specific length:
SET TALK OFF && If TALK isn't turned off, an error will occur.
SET SAFETY OFF
CREATE TABLE oneproduct ;
(PRODUCT c(15))
SET SAFETY ON
INSERT INTO oneproduct (PRODUCT) VALUES ("01PAN AG-1310")
INDEX ON PADR(SUBSTR(product, AT(" ", product)+1), ;
LEN(product)+2 ," ") TAG prod
STATUS
Microsoft is researching this behavior and will post new information here
in the Microsoft Knowledge Base as it becomes available.
Modification Type: | Major | Last Reviewed: | 2/4/2000 |
---|
Keywords: | kbprb KB165068 |
---|
|