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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Job automation

Status
Not open for further replies.

joshuaguilty

Programmer
Apr 26, 2005
81
CA
I am typing repeating steps for replacing like this.

use c:\folder1\table1
replace field1 with "AAA" for field1="aaa" and field2="Y"
replace field1 with "BBB" for field1="bbb" and field2="Y"
replace field1 with "CCC" for field1="ccc" and field2="Y"

use c:\folder1\table2
replace field1 with "AAA" for field1="aaa" and field2="Y"
replace field1 with "BBB" for field1="bbb" and field2="Y"
replace field1 with "CCC" for field1="ccc" and field2="Y"
....

Could I automate them in a script ?
Thanks.
 
if it's all just about upper case, then you could do:

Replace field1 With Upper(field1) For field2="Y"

Bye, Olaf.
 
Thank you for the response.
Actually I would like to know the way how to put them in a script file. (data quoted is just example, actual format is more complicate)
 
Just write a small program.
File , NEW select program.

Write the above code and give it a name (for example name.prg and save.

Within Foxpro DO x:\path\name.prg and the program will execute.

Edgar
IBS
 
If you want to be able to do the same thing to any file, make your program look like this:

Code:
PARAMETERS cFileName

USE (cFileName)
replace field1 with "AAA" for field1="aaa" and field2="Y"
replace field1 with "BBB" for field1="bbb" and field2="Y"
replace field1 with "CCC" for field1="ccc" and field2="Y"

You can then call this routine for each file, passing the file name. For example, if you save it as ChgFile.PRG

Code:
DO ChgFile WITH "c:\folder1\table1"
DO ChgFile WITH "c:\folder1\table2"

Tamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top