Visual studio 2010 “错误”;此处需要数字或货币金额“;crystal reports的公式编辑器

Visual studio 2010 “错误”;此处需要数字或货币金额“;crystal reports的公式编辑器,visual-studio-2010,crystal-reports-2008,Visual Studio 2010,Crystal Reports 2008,我在crystal报表中实现了一个公式,将两列数量和单价相乘,这两列都是十进制类型,但当查询返回某个值时,它不会给出异常,当查询返回任何值时,它会给出异常,如数字或货币金额 公式是 if isNULL({dtDealerStockReport.Qty})=True or isNULL({dtDealerStockReport.UnitPrice})=true then 0 else {dtDealerStockReport.Qty}*CDBL({d

我在crystal报表中实现了一个公式,将两列数量和单价相乘,这两列都是十进制类型,但当查询返回某个值时,它不会给出异常,当查询返回任何值时,它会给出异常,如数字或货币金额
公式是

if isNULL({dtDealerStockReport.Qty})=True or isNULL({dtDealerStockReport.UnitPrice})=true
     then
        0
     else

     {dtDealerStockReport.Qty}*CDBL({dtDealerStockReport.UnitPrice})

这里的问题是当quantity没有返回值时,crystal reports将为空。因此,按照下面给出的公式进行更改

if isNULL({dtDealerStockReport.Qty})=True or isNULL({dtDealerStockReport.UnitPrice})=true
     then
        0
     else if (Your conditions)

     {dtDealerStockReport.Qty}*CDBL({dtDealerStockReport.UnitPrice})
else 
0