public decimal EvaluateDecimal(Report rpt, Row row) { bool bSave; IEnumerable re = this.GetDataScope(rpt, row, out bSave); if (re == null) { return(decimal.MinValue); } ODecimal od = GetValueDecimal(rpt); if (od != null) { return(od.d); } decimal sum = 0; decimal temp; foreach (Row r in re) { temp = _Expr.EvaluateDecimal(rpt, r); if (temp != decimal.MinValue) // indicate null value { sum += temp; } } if (bSave) { SetValue(rpt, sum); } return(sum); }
public decimal EvaluateDecimal(Report rpt, Row row) { bool bSave; IEnumerable re = this.GetDataScope(rpt, row, out bSave); if (re == null) { return(decimal.MinValue); } ODecimal v = GetValueDecimal(rpt); if (v != null) { return(v.d); } decimal sum = 0; int count = 0; decimal temp; foreach (Row r in re) { temp = _Expr.EvaluateDecimal(rpt, r); if (temp != decimal.MinValue) // indicate null value { sum += temp; count++; } } decimal result; if (count > 0) { result = (sum / count); } else { result = decimal.MinValue; } if (bSave) { SetValue(rpt, result); } return(result); }