Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Michael Gill
  Where is Michael Gill?
 Flora
 Illinois - United States
 Michael Gill
 To: Patrick Dowd
  Where is Patrick Dowd?
 
 California - United States
 Patrick Dowd
 Tags
Subject: RE: Basic 'REPLACE' Question
Thread ID: 22158 Message ID: 22164 # Views: 16 # Ratings: 0
Version: Visual FoxPro 7 Category: General VFP Topics
Date: Thursday, April 10, 2003 6:32:25 PM         
   


> > Hi all,
> >
> > Can anyone tell me if I can use a
IIF
statement in a
REPLACE
statement? I get the error: "Error in line 261: Invalid use of a Visual FoxPro function as an array." at compilation of the following code:
> > SELECT a_tmpf1
> > APPEND BLANK
> > REPLACE Lineno WITH c_first.lineno, ITEM WITH c_first.item, IIF(ln_memcount = 1, BOM WITH '', BOM WITH lc_chkitem),;
> > LOCTID WITH c_first.loctid, QTY WITH c_first.qtyord, pickloc1 WITH lc_pickloc1, pickq1 WITH lc_pickq1,;
> > VndID1 WITH lc_vndid1, pickloc2 WITH lc_pickloc2, pickq2 WITH lc_pickq2, VndID2 WITH lc_vndid2;
> > REPLACE oqty WITH qty, opickloc1 WITH pickloc1, opickq1 WITH pickq1, OVndID1 WITH VndID1;
> > opickloc2 WITH pickloc2, opickq2 WITH pickq2, OVndID2 WITH VndID2, recno WITH c_first.recno &&line 261 , the IIF statement in question is 4 lines above
> >
>
> Your's: IIF(ln_memcount = 1, BOM WITH '', BOM WITH lc_chkitem),;
>
> Mine: BOM WITH IIF(ln_memcount = 1, "", lc_chkitem)
>
> Patrick

Yep, Patrick is right. You can't make an IIF statement that changes the syntax but you can make an IIF statement that returns different replace values.

---

www.foxite.com - The Home of the Visual FoxPro Experts

COMPLETE THREAD

Basic 'REPLACE' Question Posted by bleech67 toms @ 4/10/2003 4:59:04 PM
oops Posted by bleech67 toms @ 4/10/2003 5:01:38 PM
RE: Basic 'REPLACE' Question Posted by Patrick Dowd @ 4/10/2003 5:12:34 PM
RE: Basic 'REPLACE' Question Posted by Michael Gill @ 4/10/2003 6:32:25 PM