Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SOS! Think you can help me?
Message
From
17/06/1999 17:17:17
Chuck Tripi
University of Wisconsin - Milwaukee
Milwaukee, Wisconsin, United States
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00230966
Message ID:
00231099
Views:
17
>Let's start at the beginning :-)
>
>What are you trying to do and what is your code doing instead. (in words).

Thats better and thank you.

What I am trying to do is look at two tables:

TEMPCUR (it is a cursor from a table, to narrow down to only PO I need to look at a time)

HISTPO (it is a table that has HISTory of POs)

Now, what I need to do is put those two tables side by side and evaluate to see if the other fields match or not. The whole point (programmer's concept) is that the record #1 in TEMPCUR could be the same as record #2 in HISTPO and record #2 in TEMPCUR same as record #1 in HISTPO, so I need to look at each record and see if there is matching -> record by record. The odd thing is there could be two or three records in the same table that are all same (exact duplicate). Once there is a matching, I want to delete the record of both tables (during the CASE) so I can evaluate the next record since the SET DELETED ON is on, means the deleted record is out of sight.

Then if the all 4 record in both tables match, the TEMPCUR goes to TAB2 (No Action) or if there is 1 record that has any changes/updated, I dont need to go further, the TEMPCUR goes to TAB3 (Changes). All other coding were fine, execpt when I come to same number of records on both table, I need to make the coding work... All other CASEs are that is there is 1 record in TEMPCUR and 3 in HISTPO, or vise verse, which all mainly goes to TAB3.

Along with this, which is faster/optimize: LOCATE or GO TOP?

Here are the coding that runs with the problem... I can break down, but that could make the coding very clutter (harder to read):
******************************

SELECT histpo
COPY TO histtemp FOR po = varpo && (to be able to DELETE recs in a "table", leaving the HISTPO alone)
USE histtemp IN 0
SELECT tempcur
COPY TO temptemp && (to be able to DELETE recs in a "table", since cursors are read-only)
USE temptemp IN 0
SELECT temptemp
LOCATE
DO WHILE NOT EOF()
*varpo = temptemp.po
varclass = temptemp.class
varfund = temptemp.fund
varudds = temptemp.udds
varamount = temptemp.amount
varfy = temptemp.fy
varactivity = temptemp.activity
varaccount = temptemp.account
SELECT histtemp
LOCATE
DO WHILE NOT EOF()
IF class = varclass AND ;
fund = varfund AND ;
udds = varudds AND ;
amount = varamount AND ;
fy = varfy AND ;
activity = varactivity AND ;
account = varaccount
DELETE
SELECT temptemp
DELETE
EXIT
ELSE
SKIP
IF EOF()
SELECT tab3
APPEND FROM DBF("tempcur")
EXIT
ENDIF
ENDIF
ENDDO
ENDDO
SELECT histtemp
USE
SELECT temptemp
USE
DELETE FILE histtemp.dbf
DELETE FILE temptemp.dbf
******************************

I am not good with english, this is best I can do (hey, not bad for a pretty good attitude deaf guy, huh? :)
Today is tomorrow's yesterday.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform