Hi all,
Good to see some activity here again! I'm replacing an old Clipper app (not mine)with VFP7/CB6.2. Still a relative newbe to vfp (I remember when I could write apps and proceedures that mostly worked first time :( ). Anyway, I've developed a form to convert the data tables to the new app, but it's running gawd awful slow--about 10 minutes to convert a table of about 1200 records to a new table with the same amount of records and a child with up to 4 times as many records. Following is a code snippet. Can anyone spot my malfunction? ********************************** PROCEEDURE PopulateLoanTable() LOCAL lnOldSelect, lcSelection, lcFile, lcField, lnPass, lnLNR, lnAmt This.SetPrimaryBizobj(This.boLoan) lnOldSelect = SELECT(0)
SELECT 0
FOR lnPass = 1 TO 4 DO CASE CASE lnPass = 1 This.DisplayStatus('Converting from NPAWN!LOAN to EUPS!LOAN...') lcSelection = 'LOAN.*' lcFile = ALLTRIM(This.txtPath.value) + 'LOAN' lcField = 'LOAN.CNR' [snip] ENDCASE
SELECT (lcSelection), Client.iID ; FROM (lcFile) LEFT OUTER JOIN EUPS!Client ; ON &lcField # 0 .AND. &lcField = Client.cnr ; INTO CURSOR OLD SCAN This.New() REPLACE v_LoanE.cAgent WITH OLD.INIT ; v_LoanE.cLoanNr WITH PADL(ALLTRIM(STR(OLD.LNR)), 8) ; v_LoanE.dDueDate WITH OLD.DUE ; v_LoanE.dLoanDate WITH OLD.LDT ; v_LoanE.iClientID WITH IIF(!ISNULL(OLD.iID), OLD.iID, 0) ; v_LoanE.lClientOnly WITH .T. ; v_LoanE.yMonthlySC WITH NTOM(OLD.IAMT) ; v_LoanE.yPrincipleAmt WITH NTOM(OLD.LAMT) IF lnPass = 3 .OR. lnPass = 4 REPLACE v_LoanE.lPaidOff WITH .T. ; v_LoanE.dDispDate WITH OLD.POFF ENDIF This.PopulateLoanItemsTable(.F.) This.save() ENDSCAN
USE This.DisplayStatus('done') ENDFOR [snip] ************************
PROCEEDURE PopulateLoanItemsTable() LPARAMETERS lINV LOCAL x, lcMak, lcMod, lcSer, lcDes
IF lINV [snip] ELSE *code to break out items from NPAWN!LOAN FOR x = 1 TO 4 lcMak = 'OLD.MAK' + STR(x,1) lcMod = 'OLD.MOD' + STR(x,1) lcSer = 'OLD.SER' + STR(x,1) lcDes = 'OLD.DES' + STR(x,1) IF EMPTY(&lcMak) .AND. EMPTY(&lcMod) .AND. ; EMPTY(&lcSer) .AND. EMPTY(&lcDes) LOOP ENDIF This.boLoanItems.new() REPLACE v_LItems.cDescription WITH &lcDes ; v_LItems.cInventoryNr WITH cbnewid('INVENTORYNR') ; v_LItems.cMake WITH &lcMak ; v_LItems.cModel WITH &lcMod ; v_LItems.cSerial WITH &lcSer ; v_LItems.iQty WITH 1 ; v_LItems.mNotes WITH OLD.DESC + ' ' + &lcDes ENDFOR ENDIF
RETURN **************************** Thanks, Virgil ©2002 Virgil Bevans |