At 03:23 2013-12-06, "Allen" <[email protected]> wrote:
Hi Foxgang
I had a disturbing problem with VFP9 SP2 on Win 7 today
I have a scan routine looking for matching records and amending or deleting
them. It took several goes to sort out the records. I had a filter and order
on.
Took filter off and placed the filter constraints in the scan.
Same
Took the order off and fine all dealt with
Bit worrying.
Were you modifying any of the columns that were part of your
current index tag's index expression? That can position the record
pointer so as to skip or repeat parts of the table.
The following program creates a table tmp2.dbf then processes
it. When the key is "4", it is set to "2". As a result, part of the
table is processed again. Had the key been set to, say, "7", part of
the table would have been skipped.
***** Start of Included Program *****
* tmp2
* Experiment with Indexes
* Last Modification: 2013-12-06
? "*** Execution begins."
? program()
close all
clear all
set talk off
set exact on
set ansi on
drop table tmp2
create table tmp2 (thekey c(10), thedata c(40))
insert into tmp2 (thekey,thedata) values ("0","zero")
insert into tmp2 (thekey,thedata) values ("1","one")
insert into tmp2 (thekey,thedata) values ("2","two")
insert into tmp2 (thekey,thedata) values ("3","three")
insert into tmp2 (thekey,thedata) values ("4","four")
insert into tmp2 (thekey,thedata) values ("5","five")
insert into tmp2 (thekey,thedata) values ("6","six")
insert into tmp2 (thekey,thedata) values ("7","seven")
insert into tmp2 (thekey,thedata) values ("8","eight")
insert into tmp2 (thekey,thedata) values ("9","nine")
select tmp2
index on thekey tag thekey
goto top
scan
? "old "+thekey+": "+thedata
if thekey="4"
replace thekey with "2"
endif
? "new "+thekey+": "+thedata
endscan
use in tmp2
*
close all
clear all
? "*** Execution ends."
return
***** End of Included Program *****
Sincerely,
Gene Wirchenko
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.