Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
REPLace .... or SCAN ....
Message
From
14/09/2002 21:14:46
 
 
To
14/09/2002 19:22:02
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00700335
Message ID:
00700575
Views:
15
I think that's a good theory Dragan.

cheers

>>Don't you think the ALL might have something to do with it?
>
>Didn't know without trying (changes bolded):
>
>>>
CREATE CURSOR temp (nfld i, cfld c(10))
>>>FOR i=1 TO 20
>>>	INSERT INTO temp (nfld, cfld) VALUES (RECNO(), "abc")
>>>ENDFOR
>>>INDEX ON <b>n</b>fld TAG fld
>>>
>>>replace nfld WITH nfld*10;	
>>>	cFld WITH TRIM(cFld)+"d" <b>FOR BETWEEN(nFld, 5,10)</b>
>>>	
>>>browse
>
>And it works on exactly these six records, no problem. With a scan-endscan, it would do one record and exit.
>
>The theoretical explanation here, IMO, is that the Replace (and also Delete, Recall, Report, List etc) command with a scope first builds a bitmap with records to work on (with each bit 1'd for the records in scope, and 0'd for the rest) and then follows that bitmap. Scan, however, is not a single command, it's a loop, so it has to reevaluate its scope each time. IOW, commands with a scope get the scope, and perform their thing on all records in the scope (regardless of the records potentially falling out of the scope during the operation); loops (scan-endscan, do while - skip - enddo) find the first record in scope, let the block of commands be performed, find the next record in scope - and they do it by moving from the current record to the next, and find or don't find such a record. Whether the current record is not the same as the last time, or is not in the same place as before, or the current order has changed, is beyond the responsibility of these loops.
Previous
Reply
Map
View

Click here to load this message in the networking platform