FIX: "Invalid Subscript Reference" Error If UDF in SET FILTERLast reviewed: October 29, 1997Article ID: Q139092 |
2.60a
WINDOWS
kbprg kbbuglist kbfixlist
The information in this article applies to:
SYMPTOMSThe error message "Invalid Subscript Reference" appears when you use a UDF (user defined function) in a SET FILTER expression.
CAUSEFoxPro 2.x does not allow UDF calls to be used in a SET FILTER expression.
WORKAROUNDUpgrade to Microsoft Visual FoxPro version 3.0 or do not use a UDF in a SET FILTER expression. If the logic in the UDF is simple, it can be incorporated directly into the SET FILTER condition. If the logic in the UDF is too complex to be incorporated into the SET FILTER expression, use a different approach to process a subset of the records such as the SELECT - SQL command or SCAN.
STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in Visual FoxPro version 3.0.
MORE INFORMATIONThis behavior is not affected by the SET COMPATIBLE setting. In dBASE IV, it is possible to use a UDF in a SET FILTER expression. The UDF will function as expected, and no error messages will be returned.
Steps to Reproduce ProblemThe following code produces a "Invalid Subscript Reference" error message when used in FoxPro. When used in dBASE IV, no errors occur. The LIST command produces a single record with the value of "BB."
CREATE TABLE test (one C(2)) INSERT INTO test (one) VALUES ("AA") INSERT INTO test (one) VALUES ("BB") INSERT INTO test (one) VALUES ("CC") INSERT INTO test (one) VALUES ("DD") SET FILTER TO myudf() LIST FUNCTION myudf retval = .F. IF one = "BB" retval = .T. ENDIF RETURN(retval) |
Additional reference words: 2.60a FoxWin VFoxWin fixlist3.00 buglist2.60a
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |