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

replace with a list

Status
Not open for further replies.

Kerbouchard

IS-IT--Management
Aug 28, 2002
145
US
This is probably a simple answer but I can't seem to find it anywhere.

If I want to use replace based on a list of data for a field how do I do it?

Example which doesn't work but you'll see what I'm trying to do--

replace all;
cust.salsmn1 with "ART003", cust.comrate with 10, cust.terr with "03" for cust.zip="06430" and type in ("REST","CLUB","CRUI/AIR")

Thanks in advance for the help!!
 
If I understand correctly, try this instead:

Code:
replace all;
  cust.salsmn1 with "ART003", cust.comrate with 10, cust.terr with "03" ;
  for cust.zip="06430" ;
  AND [COLOR=blue]INLIST(type , "REST","CLUB","CRUI/AIR")[/color]

-Dave Summers-
[cheers]
Even more Fox stuff at:
 
If I understand your question about "type in ...", you should be looking at using Macro Substitution.

Something like:

Code:
* --- User enters the following somehow ---
mcTypeIn = "'REST,CLUB,CRUI/AIR'"

mcVFPCommand = "REPLACE ALL cust.salsmn1 WITH 'ART003',";
   + " cust.comrate WITH 10,";
   + " cust.terr WITH '03'";
   + " FOR cust.zip='06430'";
   + " AND ALLTRIM(cust.type) $ " + mcTypeIn
 
* --- Now Execute Command ---
&mcVFPCommand

NOTE: Be cautious of use of single and double quotes as coordinated 'pairs' so as to keep the string working properly.

If I didn't include too many typos, that should work.

Good Luck,
JRB-Bldr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top