SELECT INMAST.FPARTNO, Sum(INONHD.FONHND); FROM INONHD RIGHT JOIN INMAST; ON INONHD.FPARTNO=INMAST.FPARTNO; WHERE &LCWHERE; GROUP BY INMAST.FPARTNO; INTO CURSOR TMP1The IIF() won't work to acheive what you want, but in other cases it can be used in the SELECT-SQL. The syntax should be:
SELECT IIF(EMPTY(INONHD.FONHND), 0, INONHD.FONHND) AS FONHNDBTW, is INONHD.FONHND as character field? If so, you would need to add a Val() to the Sum() in the SELECT.
SELECT INMAST.FPARTNO, INONHD.FONHND ; > FROM INONHD RIGHT JOIN INMAST; > ON INONHD.FPARTNO=INMAST.FPARTNO; > WHERE &LCWHERE; > INTO CURSOR TMP1>LCWHERE is concatenated according to other conditions within the form...is there a way to put like an IIF() like this?
SELECT INMAST.FPARTNO,IIF(EMPTY(INONHD.FONHND),'0' AS FONHND,INONHD.FONHND)...>I've tried the above and it keeps giving me an error when the SQL is executed that it needs a )....got any ideas?