Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Pulling Data from a Huge Cursor
Message
From
25/02/2014 03:51:00
 
 
To
25/02/2014 02:21:58
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01595090
Message ID:
01595100
Views:
63
Sir, I am Not a software Professional nor Earn Money from It. I am finance Professional.

Currently I am working on a Small Project and trying to create a tool with Just Two Objectives.

(1) To Save Paper Wastage ( i.e To ultimately serve the Environment) , if I completely succeed there would be millions of saving of A-4 size paper each month.

(2) To Enhance my own Skill in coding and Programming.

Yes, I frequently ask my problems on this forum and also try to render answer to any of the members if I have (Though I have vary little Knowledge in VFP).

Regards,
Harsh


>Do you set a solution under GPL or do you earn money with it?
>
>Somehow it seems to me that you come up with all your coding problems here.
>
>>Hi,
>>Kindly Consider the following code. The Code Is Extracting Data Between Two '%%Page: 1' From a Cursor.
>>
>>There are over 1800000 Records and I need to Extract Data From Start of '%%Page: 1' to One Prior Record Before next '%%Page: 1'. Than again From Next '%%Page: 1' to One Prior Record Before next '%%Page: 1'.
>>
>>But Gradually The Extraction becomes Slow and becomes very consuming.
>>
>>Is there can be any SQL for such Purpose that May serve better
>>
>>Note:- Please Do Not suggest Indexing as I will not serve my purpose, perhaps.
>>
>>
>>SELECT ALLBILLS
>>SELECT COUNT(POS) FROM Allbills WHERE LEFT(ALLTRIM(pos),9)='%%Page: 1' INTO ARRAY nNumberofbillsincurrentfile
>>nBillend=0
>>FOR I=1 TO m. nNumberofbillsincurrentfile
>>SELECT AllBILLS
>>LOCATE FOR LEFT(ALLTRIM(POS),9)='%%Page: 1' AND RECNO()>m.nBillEnd && Bill Starts From Here and This is the First Page
>>nPageonestart=RECNO()
>>LOCATE FOR LEFT(ALLTRIM(POS),9)='%%Page: 2' AND RECNO()>m.nPageonestart && Page One Ends Here
>>nPageoneend=RECNO()
>>LOCATE FOR LEFT(ALLTRIM(POS),9)='%%Page: 1' AND RECNO()>m.nPageoneend && Next Bills Starts From Here
>>nBillEnd=RECNO()
>>LOCATE FOR STREXTRACT(POS,'(',')')='Account Number' AND RECNO()>m.nPageoneend AND RECNO()<m.nBillend
>>SKIP
>>oFileName=STREXTRACT(POS,'(',')')
>>oFileName='D:\HARSH\'+oFileName+'.Ps'
>>LOCATE FOR ALLTRIM(POS)="20.699 184.238 MV (. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .)S"
>>Replace POS WITH '20.699 184.238 MV (. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . )SH'
>>SELECT POS FROM Allbills INTO CURSOR Splitfile Where RECNO()=>m.nPageoneend AND RECNO()<m.nBillEnd Readwrite
>>Set Textmerge ON
>>Set Textmerge To (m.oFileName) Noshow
>>SCAN
>>\\<< TRIM(POS) >>
>>\
>>ENDSCAN
>>Set Textmerge To
>>Set Textmerge OFF
>>DELETE FROM Allbills Where RECNO()=>m.nPageonestart AND RECNO()<=m.nBillEnd
>>WAIT WINDOW I Nowait
>>ENDFOR
>>
Harsh
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform