This content has been marked as final. Show 2 replies
I'm trying to add grossmargin percent calculation in edit script from ODBC database (Sql server). The problem is that sometimes sales maybe 0 for row and then the script ends up to an error. I would need to check if sales is zero then gm%=0 else the formula. I have tried the following (below) but it just says "Incorrect syntax near the keyword 'If'. Please help me on this one how to do this.
CONNECT32 TO TUOTANTO2 (XUserId is xx, XPassword is xx);
SQL SELECT CustName,
if (Sales=0, 0, ((Sales-DirVarLabCost-MaterialCost)/Sales*100)) AS GMPros