public double EvaluateDouble(Report rpt, Row row)
        {
            bool        bSave = true;
            IEnumerable re    = this.GetDataScope(rpt, row, out bSave);

            if (re == null)
            {
                return(double.NaN);
            }

            ODouble v = GetValueDouble(rpt);

            if (v != null)
            {
                return(v.d);
            }

            double sum = 0;
            double temp;

            foreach (Row r in re)
            {
                temp = _Expr.EvaluateDouble(rpt, r);
                if (temp.CompareTo(double.NaN) != 0)
                {
                    sum += temp;
                }
            }
            if (bSave)
            {
                SetValue(rpt, sum);
            }

            return(sum);
        }
Beispiel #2
0
        public double EvaluateDouble(Report rpt, Row row)
        {
            bool        bSave = true;
            IEnumerable re    = this.GetDataScope(rpt, row, out bSave);

            if (re == null)
            {
                return(double.NaN);
            }

            ODouble od = GetValue(rpt);

            if (od != null)
            {
                return(od.d);
            }

            double sum   = 0;
            double sum2  = 0;
            int    count = 0;
            double temp;

            foreach (Row r in re)
            {
                temp = _Expr.EvaluateDouble(rpt, r);
                if (temp.CompareTo(double.NaN) != 0)
                {
                    sum  += temp;
                    sum2 += (temp * temp);
                    count++;
                }
            }

            double result;

            if (count > 1)
            {
                result = Math.Sqrt((count * sum2 - sum * sum) / (count * (count - 1)));
            }
            else
            {
                result = double.NaN;
            }

            if (bSave)
            {
                SetValue(rpt, result);
            }

            return(result);
        }