Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Enhancing Performance
Message
From
20/06/2014 10:21:54
 
 
To
20/06/2014 08:25:28
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01602118
Message ID:
01602133
Views:
85
Yes sir Reverse Scanning is essential because (Page 3), (Page 2) etc are at the bottom and based on those Values I have to insert Data after Beginsetup.

Alternativey if I create a Cursor based on reverse order of Record Number RECNO(), Will Scan command will work Faster ?

After I have finished I will make the order as it was before. But this will be faster . Don't Know ???

I will also try to incorporate the changes you have suggested. Thanks



>Hi Harsh:
>
>This is just a quick optimization, because there are few things you haven't explained, as if it is necessary to scan in reverse order or what do the external SCAN is for.
>
>
>
>LOCAL lnRecord, lnCount
>Insertone=0
>Inserttwo=0
>lmultipage=.F.
>
>SCAN
>	Newpath=Newpath
>	*WAIT WINDOW m.Newpath NOWAIT
>	*CREATE CURSOR BillFile (POS VARCHAR(254))	&& IF YOU ARE USING THE REAL VARCHAR, YOU ARE USING A MEMO FIELD, WHICH IS SLOOOOWWW
>	CREATE CURSOR BillFile (POS C(254))
>	APPEND FROM (m.Newpath) SDF
>
>	SELECT BillFile
>	lnCount		= 0
>
>	GO BOTTOM
>	DO WHILE NOT BOF()
>		lnCount	= lnCount + 1
>
>		DO CASE
>		CASE LEFT(POS,8)='(Page 1)'
>			cTextone='<</Duplex false/PageSize  [595 842] /Tumble false /ManualFeed false /MediaPosition 0>>  setpagedevice'
>			Insertone=1
>			Inserttwo=0
>
>		CASE LEFT(POS,8)='(Page 3)'
>			lmultipage=.T.
>
>		CASE LEFT(POS,8)='(Page 2)'
>			Insertone=0
>			Inserttwo=1
>
>			IF lmultipage=.T.
>				cTexttwo='<</Duplex true /PageSize [595 842]/Tumble false /ManualFeed false /MediaPosition 2>> setpagedevice'
>			ELSE
>				cTexttwo='<</Duplex false /PageSize [595 842]/Tumble false /ManualFeed false /MediaPosition 2>> setpagedevice'
>			ENDIF
>			lmultipage=.F.
>
>		CASE LEFT(POS,16)='%%BeginPageSetup'
>			IF Insertone=1
>				*INSERT BLANK
>				*REPLACE POS WITH cTextone
>				*SKIP-2
>				lnRecord	= RECNO()
>				INSERT INTO BillFile (POS) VALUES (cTextone)
>				GOTO (lnRecord)
>				*--
>				Insertone=0
>				Inserttwo=0
>			ENDIF
>
>		CASE LEFT(POS,16)='%%BeginPageSetup'
>			IF Inserttwo=1
>				*INSERT BLANK
>				*REPLACE POS WITH cTexttwo
>				*SKIP-2
>				lnRecord	= RECNO()
>				INSERT INTO BillFile (POS) VALUES (cTexttwo)
>				GOTO (lnRecord)
>				*--
>				Insertone=0
>				Inserttwo=0
>			ENDIF
>		ENDCASE
>
>
>		SKIP-1
>		
>		*-- THIS IS IMPORTANT
>		IF MOD(lnCount, 100) = 0
>			WAIT WINDOW 'Remaining Records...'+ALLTRIM(STR(RECNO())) NOWAIT
>		ENDIF
>	ENDDO
>
>	WAIT WINDOW 'Remaining Records...'+ALLTRIM(STR(RECNO())) NOWAIT
>	SET TEXTMERGE ON
>	SET TEXTMERGE TO (m.Newpath) NOSHOW
>
>	SCAN
>\\<< TRIM(POS) >>
>\
>	ENDSCAN
>
>	SET TEXTMERGE TO
>	SET TEXTMERGE OFF
>	FLUSH
>	SELECT New_bills
>ENDSCAN
>
>
>
>Best regards!
Harsh
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform