Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Foxpro 2.6 Code to Update Database 2

Status
Not open for further replies.

jlg13

Technical User
May 10, 2001
61
US
Hi All,

Need help adding an update database to existing code.

So as mentioned in other threads with pleads for help... I am a novice programmer, my dad had built all my programs, I am maintaining them.

In this one program, we run a series of data validity checks before executing a larger procedure. One of those validity checks I have pasted that code below. The database used is called CONTRACT and the check is to calculate a date and then see if that date matches what is in the database. If it doesn't, the program writes out the discrepancy to a report. Due to COVID19, a bunch of changes occurred which resulted in several hundred discrepancies. My goal is to convert the below to a standalone program and rather than report the discrepancy, I would like it to update the Contract database with the calculated "PROGRAM" value.

If anyone can provide solution and explain, I am trying to learn. Thank you.

Joe


USE Contract IN 0 && 03/12/2006 ORDER TAG acctno
@ ROW()+1,5 SAY "Last Due Date Report " COLOR W+
STORE 0 TO lnWrong, lnChk, lnSkipB, lnSkipP
? "LAST DUE DATE REPORT" AT 5
?
SELECT Contract

SCAN
IF Contract.bal_due = 0
lnSkipB = lnSkipB+1
LOOP
ENDIF
m.acctno = Contract.acctno && 11/05/2002
SELECT COUNT(*) AS count FROM Ma_Misc;
WHERE Ma_Misc.acctno = m.acctno AND Ma_Misc.status = "POP";
INTO CURSOR test
IF count > 0
lnSkipP = lnSkipP+1
LOOP
ENDIF
lnChk = lnChk+1
nwlast_due = CalcDate(Contract.pymt_ddate,Contract.frequency,Contract.t_num_pymt,Contract.pymt_num) && 12/02/11
IF nwlast_due # Contract.last_due
IF YEAR(Contract.pymt_ddate) = 2099 AND;
(Contract.status = "SUS" OR (RIGHT(Contract.status,1) = "S" AND LEFT(Contract.status,1) = "W")) && Indefinite suspend 01/25/13
LOOP
ENDIF
IF lnWrong = 0
? " CONTRACT PROGRAM" AT 1
? "ACCTNO DATE DATE " AT 1
ENDIF
lnWrong = lnWrong+1
? Contract.acctno+" "+DTOC(Contract.last_due)+" "+DTOC(nwlast_due) AT 1
ENDIF
ENDSCAN
 
Where you have:
Code:
? Contract.acctno+" "+DTOC(Contract.last_due)+" "+DTOC(nwlast_due) AT 1

put
Code:
SELECT CONTRACT
REPLACE CONTRACT.LAST_DUE with NWLAST_DUE

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Thank you! I am not at all embarrassed by the simplicity of that :))))

Trust me, I would have muffed it up!

Thanks again. You saved my 6 hours of manual updating and all the errors that go along with that!

My dad made a "Temp" program accessible from our menu so I'll just slide this in and run it.

Joe
 
Happy to have helped

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Worked like a charm!!

I'll be back. This forum is a life saver
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top