Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Speeding up code-scan,update (follow-up from last Thursd
Message
 
 
To
19/08/2008 13:01:43
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01340003
Message ID:
01340004
Views:
11
>Hi all,
>
>Follow-up from last Thursday's thread# 1338981
>
>this is one scan endscan that I have in my program ( I inherited it, working on cleaning it up. :D)
>
>SELECT srvceid, COUNT(DATE) AS wrksrvceDate , ALLT(STR(MONTH(DATE)))+ALLT(STR(YEAR(DATE))), ;
>  C1, C4 ;
>  FROM cost, cstcoef ;
>  WHERE cost.costcoef == cstcoef.coefid AND ;
>  (RIGHT("00"+ALLT(STR(MONTH(DATE))),2)+ALLT(STR(YEAR(DATE)))=ALLTR(sPeriod) ;
>  AND NOT EMPTY(dateappr) AND ALLT(STATUS)=='' AND NOT schoolclose AND NOT Cancelled) ;
>  GROUP BY srvceid, C1, C4 ;
>  INTO CURSOR c7
>
>SELECT (sCur)
>GO TOP
>SCAN
>  SELECT (sCur)
>  UPDATE BL731 SET BL731.wrksrvceDate=c7.wrksrvceDate ;
>    WHERE srvceid=c7.srvceid AND C1 = c7.C1 AND C4 = c7.C4
>ENDSCAN
>USE IN c7
>
>
>Rich suggested that I use index and replace all. My problem with indexes is that srvceid is a character field and c1 and c4 are numeric. How would I make a index for a character and numerical index without causing problems for the data?
>
>TIA
>Beth

If you're using Integer fields, look at BINTOC function. Otherwise just use STR() function to build the complex index.

Also you don't need select (sCur) and GO TOP. You're scanning C7, right?

BTW, are you sure that c1 and c4 fields are numeric and SrvceID is character? Based on the names I would assume the opposite.

Also it looks like you're running with ENGINEBEHAVIOR set to 70 (because of the extra field in your result).
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform