Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a faster way????
Message
From
01/03/2001 17:01:16
Gavin Reid
L & M Marketing Pty Ltd
Frenchs Forest, Australia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00481135
Message ID:
00481141
Views:
12
Hi Leroy,

Have you tried opening the tables exclusively? Replaces, Inserts, Appends, Etc run faster when the table is opened exclusively.

Hope this helps,
Gavin...

>Hello everybody!!!!
>
>I posted yesterday that I was trying to read this file into a table.
>Well I used Nadya's Advice and it work perfectly. I got everything into a strickly character table. However I could not stop there because my numbers needed to be in the form of currency. I had some numbers in the table that looked like 16348.00- in the field.
>So I made a replica of that table but fixed the table with the right format.
>
>I wrote a program that will pop each line of the character table into the real table when it gets to the character numbers, it will check to see if it is a positive or negative number, format it appropriatly, and pop it into the real table.
>
>This worked fine while the file I was using was about 20,000 records. I mean it ran in less than 4 minutes.
>
>Now the file size has changed to over 120,000 records. Now it takes 25-30 minutes for it to run. I get the desired result but is there a faster way of getting this to run?
>Here is the sample of the loop and replace statements that I am doing:
>
>SCAN
>SELECT STK_REC_REAL && this is the real table that we will work with
>APPEND BLANK
>FOR START = 1 TO NUMFIELDS && loop through the record
> SELECT STK_REC_NUM2 && look at the character table
> IF START != NUMFIELDS && am I at the last field
> THISFIELD = FIELD(START)
> lcField = &THISFIELD
> lcField = ALLTRIM(lcField)
> ENDIF
> IF START = 5 && this is a string date like yymmdd ei '010228'
> ldfield = STRINGYMDTODATE(lcField) && converts to a real date ei {02/28/01}
> ENDIF
> IF START >= 11 AND START < NUMFIELDS && fields with digits in them
> IF RIGHT(lcField,1) = '-' && if negative
> lcField = STRTRAN(lcField,RIGHT(lcField,1))
> lcField2 = '-'+lcField
> lnField = VAL(lcField2)
> ELSE && if positive
> lnField = VAL(lcField)
> ENDIF
> ENDIF
> SELECT STK_REC_REAL && look at the real table
> DO CASE
> CASE START < 11 && not a field with currency in it
> REPLACE &THISFIELD WITH lcField
> CASE START >=11 AND START < NUMFIELDS && field with currency
> REPLACE &THISFIELD WITH lnField
>
> CASE START = NUMFIELDS && the real date field
> REPLACE REALDATE WITH ldField
> ENDCASE
>ENDFOR
>ENDSCAN
>
>Like I said, This works but There has got to be a faster way.
>
>I am sorry it is hard to read. I don't know how to make it look like real VFP code in the UT.
>
>Thanks in advance for the advice.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform