Hi All
I don't remeber if this problem was yet discussed, if my problem is an old problem remove this post 8).
Using cursors that have an index on a zero allowed integer column and using bintoc on this index to aggregate the column on other columns, in some cases the index isn't updated properly.
I found that the problem appear when the index is created when the cursor is populated (creating cursor before filling the cursor solve the problem). Another consideration is on the values, some records must have the integer column equal to 0, and last but not least the number of record inserted on the table can have influence on correct updating of index cursor.
**-------------------------------------------------
Create Cursor test(CodeTest char(5), Num I NULL)
Insert into test(CodeTest, Num) values ('Code1', 1)
Insert into test(CodeTest, Num) values ('Code1', 0)
cSeekExpr = CodeTest + BinToC(Num) && I want found this record, i retrive the index key!
Insert into test(CodeTest, Num) values ('Code2', 0) && Removing this line the problem doesn't exists
Index On (CodeTest + BinToC(Num)) tag Num && Moving this line after Create cursor the problem doesn't exists
** The actual Tag is "Num"
** So i expect that following sequence for the first 2 records
** Codetest Num
** ------------------
** Code1 0
** Code1 1
**
** But the order is
** Codetest Num
** ------------------
** Code1 1
** Code1 0
** The index was not created properly!!
GO TOP
ACTIVATE SCREEN
clear
? 'Actual Key: ' + KEY()
? 'Codetest Num'
? '-----------------'
? RTRIM(Codetest), Num
SKIP +1
? RTRIM(Codetest), Num
SKIP +1
** cSeekExpr is the key retrvieved from second record inserted
?
? 'Searching for: "Code1" + BINTOC(0)'
? 'Found() = ', SEEK(cSeekExpr)
USE in test
bye, Emanuele!
In the beginning the Universe was created.
This has made a lot of people very angry and been widely regarded as a bad move.