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!

Replace statement - adding another field to replace (Fox 2.6) 1

Status
Not open for further replies.

jlg13

Technical User
May 10, 2001
61
US
Hi Fox Experts,

Hope everyone is still doing well. Thanks for all the help. I am learning and saving time. Very appreciated.

I have a workable replace statement as shown below.

REPLACE ALL contract.pymt_ddate WITH GOMONTH(Contract.pymt_ddate,360) FOR BETWEEN(contract.pymt_ddate, {21/03/2020}, {31/12/2025}) AND LEFT(Contract.acctno,3)="219" AND contract.bal_due > 0 AND RIGHT(contract.dqstatus,2) <> "LY"

I want to add a 2nd date field to the Replace statement

contract.last_due

Same 360 months
same criteria

I think the start is REPLACE ALL contract.pymt_ddate, contract.last_due WITH

Not sure how to modify GOMONTH(Contract.pymt_ddate,360)

Thank you,
Joe
 
First, if the condition for updating the second field isn't the same as for the first field, you need two separate REPLACE statements.

If the condition for updating the second field is the same as for updating the first field, then you just need to give each field its own WITH clause:

[pre]REPLACE contract.pymt_ddate WITH GOMONTH(Contract.pymt_ddate,360), ;
contract.last_due WITH GOMONTH(Contract.last_due,360) ;
...
[/pre]

Incidentally, there's no reason to have the alias in front of the field name in REPLACE (at least on the left side of the WITH). While it's permitted, you should never write a REPLACE statement that changes fields in more than one table at a time. The way to tell REPLACE what table you're talking to is by adding the IN clause at the end of the statement:

[pre]REPLACE x WITH y, z WITH q IN myalias[/pre]

Tamar
 
Hi,
Are you sure you want to jump 360 months ahead as you do with GOMONTH(Contract.Last_Due, 360) - that is 30 years?
hth
MarK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top