Hi Ted,
Another Requery() would certainly reset this behavior.
However my use case is different: I need to copy the records currently
fetched on a remote view using FetchAsNeeded.
SELECT ... FROM ... INTO ... causes VFP (and/or ODBC) to pull the
complete record set out of the database.
Setting MaxRecords to RecordsFetched prevents this behavior but
resetting MaxRecords to previous value 'blocks' progressive fetching to
RecordsFetched as the provided code illustrated.
As Requery() 'resets' progressive FetchAsNeeded, we don't know how to
restore the RecordsFetched count in the cursor.
However, we found the workaround below -- this code uses:
- if CursorSetProp("fetchAsNeeded", .F.): select-SQL
- if CursorSetProp("fetchAsNeeded", .T.): SCAN-SCATTER-GATHER
&& Workaround to being unable to CursorSetProp("MaxRecords") twice
close tables all
clear
set asserts on
use tastrade!customer_rview && {en} replace by any of your remote views
assert CursorSetProp("fetchAsNeeded", .T.) && .F. uses select-SQL, .T.
uses SCAN-SCATTER-GATHER
assert CursorSetProp("fetchSize", Iif(CursorGetProp("fetchAsNeeded"),
20, -1))
? "fetchAsNeeded", CursorGetProp("fetchAsNeeded")
? "MaxRecords", CursorGetProp("MaxRecords") && -1
assert Requery() = 1
if CursorGetProp("FetchIsComplete") && {en} here is the trick {fr} ici
est l'astuce
? "All records fetched: we can use select-SQL"
select *;
from customer_rview;
into cursor test
else
? "Not all records fetched: use SCAN-SCATTER-GATHER"
AFields(aa)
create cursor test from array aa
select customer_rview
go top
scan next CursorGetProp("RecordsFetched")
scatter name customer_rview
select test
append blank
gather name customer_rview
endscan
endif
? "Records copied", Reccount('test') && 20
Thierry Nivelet
FoxInCloud
Give your VFP app a second life in the cloud
http://foxincloud.com/
*LA FRANCE N'A PAS PEUR*
Le 28/11/2015 13:00, Ted Roche a écrit :
Thierry:
Did you perform a second Requery after you changed the MaxRecords setting?
On Fri, Nov 27, 2015 at 8:53 AM, Thierry Nivelet
<[email protected]> wrote:
Hi,
All is in the code below ... any idea for a work around?
Thanks,
set asserts on
use tastrade!customer_rview nodata && replace by any of your remote views
assert RecCount() = 0
assert CursorSetProp("fetchAsNeeded", .T.)
assert CursorSetProp("fetchSize", 20)
assert CursorSetProp("MaxRecords", 30)
assert Requery() = 1
go 21
assert Recno() = 21
assert RecCount() = 30 && pulls in MaxRecords above
*
assert CursorSetProp("MaxRecords", 50)* && this instruction seems ignored
go 31 && should pull in another set of 20 records but no -- "record is out
of range" error
assert CursorSetProp("fetchAsNeeded", .F.)
go 31 && still no
--
Thierry Nivelet
FoxInCloud
Give your VFP app a second life in the cloud
http://foxincloud.com/
*LA FRANCE N'A PAS PEUR*
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
[excessive quoting removed by server]
_______________________________________________
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/[email protected]
** 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.