> > 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