Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Scan and Update with 2 cursors
Message
From
20/08/2008 16:19:57
 
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:
01338981
Message ID:
01340536
Views:
8
>>>Hi Beth,
>>>
>>>Evan's message forced me to re-look at your problem. You need to set your relation the other way around from the table you're updating to the extra cursor. This way I hope it will work.
>>>
>>Naomi is right...(why am I not surprised)
>>You need to create the index in BL, SELECT bl731, SET RELATION INTO bl, and then do the REPLACE ALL.
>>
>
>I'm quite surprised, because it's such a rare occurrence :)

Okay, That seems to be working correctly. I am running some more tests, but I found a different update problem to look at.

If I need to start another thread, I will.

I have 2 tables/cursors being updated by another cursor. 1 cursor needs to be updated matching the c1 and c4 info for one field, and another field needs to not match c1 and/or c4 but match the other 3 fields. Should I build the indexes for the matching fields first and run that replace, then build the index with the not matching (and how would I do that?) and run that replace?

Here is the code:
SELECT c5
SCAN
  UPDATE BL731 SET wrkNbrDate=c5.wrkNbrDate ;
    WHERE srvcid=c5.srvcid AND ;
    UBILLDIST=c5.UBILLDIST AND ;
    stdntid=c5.stdntid AND ;
    C1 = c5.C1 AND C4 = c5.C4
  UPDATE BL731 SET wrkNbrday2=c5.wrkNbrDate ;
    WHERE srvcid=c5.srvcid AND ;
    UBILLDIST=c5.UBILLDIST AND ;
    stdntid=c5.stdntid AND ;
    (C1 <> c5.C1 OR C4 <> c5.C4)
  UPDATE ctmpc1 SET wrkNbrday2=c5.wrkNbrDate ;
    WHERE srvcid=c5.srvcid AND ;
    UBILLDIST=c5.UBILLDIST AND ;
    C1 = c5.C1 AND C4 = c5.C4
ENDSCAN
USE IN c5
Again, Thanks for the help.
Beth
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform