General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Did anybody meet this bug?
Hi all,
command LOCATE called on indexed table within class method, where class property is in FOR clause, cause error "Variable ... is not found".
Is this problem anywhere reported?
Jiri
*--------------------------------------------------------
Code sample:
*----------------------------
CLOSE ALL
CLEAR ALL
CREATE TABLE Tab1 (Field1 C(3))
INDEX ON Field1 TAG Field1
INSERT INTO Tab1 VALUES("ABC")
INSERT INTO Tab1 VALUES("123")
INSERT INTO Tab1 VALUES("XYZ")
USE
o = CREATEOBJECT("cTest", "TAB1.DBF")
? o.Find("123")
*----------------------------
DEFINE CLASS cTest AS Custom
cField1 = SPACE(3)
cDBF = ""
PROCEDURE Init
LPARAMETERS tcDBF
THIS.cDBF = tcDBF
ENDPROC
PROCEDURE Find
LPARAMETERS tcValue
USE (THIS.cDBF) ALIAS aTab
THIS.cField1 = tcValue
LOCATE FOR Field1 = THIS.cField1
WITH THIS
WAIT WINDOW ".cField1 = '" + .cField1 + "'"
*---- next command cause error "Variable 'CFIELD1' is not found"
LOCATE FOR aTab.Field1 = .cField1
*---- next two commands resolve this problem
* LOCATE FOR aTab.Field1 = THIS.cField1
* LOCATE FOR aTab.Field1 = .cField1 NOOPTIMIZE
RETURN FOUND()
ENDWITH
USE
ENDPROC
ENDDEFINE
*----------------------------
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only