Esempio n. 1
0
        // Evaluate is for interpretation  (and is relatively slow)
        public object Evaluate(Report rpt, Row row)
        {
            bool          bSave = true;
            RowEnumerable re    = this.GetDataScope(rpt, row, out bSave);

            if (re == null)
            {
                return(null);
            }

            object v = GetValue(rpt);

            if (v == null)
            {
                object    temp;
                ArrayList ar = new ArrayList(Math.Max(1, re.LastRow - re.FirstRow + 1));
                foreach (Row r in re)
                {
                    temp = _Expr.Evaluate(rpt, r);
                    ar.Add(temp);
                }

                v = ar;
                if (bSave)
                {
                    SetValue(rpt, v);
                }
            }
            return(v);
        }
Esempio n. 2
0
        public object Evaluate(Report rpt, Row row)
        {
            bool          bSave = true;
            RowEnumerable re    = this.GetDataScope(rpt, row, out bSave);

            if (re == null)
            {
                return(null);
            }

            object v = GetValue(rpt);

            if (v == null)
            {
                Row saver = null;
                if (re.Data.Count > 0)
                {
                    saver = re.Data[re.LastRow] as Row;
                }

                foreach (Row r in re)                           // loop thru to end
                {
                    saver = r;
                }
                v = _Expr.Evaluate(rpt, saver);
                if (bSave)
                {
                    SetValue(rpt, v);
                }
            }
            return(v);
        }
Esempio n. 3
0
        public object Evaluate(Report rpt, Row row)
        {
            object v = null;

            if (row == null)
            {
                return(null);
            }
            bool          bSave = true;
            RowEnumerable re    = this.GetDataScope(rpt, row, out bSave);

            if (re == null)
            {
                return(null);
            }

            Row crow = null;

            foreach (Row r in re)
            {
                if (r == row)
                {
                    break;
                }
                crow = r;
            }
            if (crow != null)
            {
                v = _Expr.Evaluate(rpt, crow);
            }
            return(v);
        }
        public int EvaluateInt32(Report rpt, Row row)
        {
            bool          bSave = true;
            RowEnumerable re    = this.GetDataScope(rpt, row, out bSave);

            if (re == null)
            {
                return(0);
            }

            int count = re.LastRow - re.FirstRow + 1;

            return(count);
        }
        public int EvaluateInt32(Report rpt, Row row)
        {
            bool          bSave = true;
            RowEnumerable re    = this.GetDataScope(rpt, row, out bSave);

            if (re == null)
            {
                return(0);
            }

            int v = GetValue(rpt);

            if (v < 0)
            {
                object    temp;
                int       count = Math.Max(2, re.LastRow - re.FirstRow);
                Hashtable ht    = new Hashtable(count);
                foreach (Row r in re)
                {
                    temp = _Expr.Evaluate(rpt, r);
                    if (temp != null)
                    {
                        object o = ht[temp];                            // search for it
                        if (o == null)                                  // if not found; add it to the hash table
                        {
                            ht.Add(temp, temp);
                        }
                    }
                }
                v = ht.Count;
                if (bSave)
                {
                    SetValue(rpt, v);
                }
            }
            return(v);
        }
Esempio n. 6
0
        public object Evaluate(Report rpt, Row row)
        {
            object v = null;

            if (row == null)
            {
                return(null);
            }
            bool          bSave = true;
            RowEnumerable re    = this.GetDataScope(rpt, row, out bSave);

            if (re == null)
            {
                return(null);
            }

            Row  crow  = null;
            bool bNext = false;

            foreach (Row r in re)
            {
                if (bNext)
                {
                    crow = r;
                    break;
                }
                if (r.RowNumber == row.RowNumber)
                {
                    bNext = true;
                }
            }
            if (crow != null)
            {
                v = _Expr.Evaluate(rpt, crow);
            }
            return(v);
        }
Esempio n. 7
0
        // return an IEnumerable that represents the scope of the data
        protected RowEnumerable GetDataScope(Report rpt, Row row, out bool bSave)
        {
            bSave = true;
            RowEnumerable re = null;

            if (this._Scope != null)
            {
                Type t = this._Scope.GetType();

                //150208AJM GJL Trying - And Succeeding!!! to get data from chart
                if (t == typeof(Chart))
                {
                    Chart c = (Chart)this._Scope;
                    this._Scope = c.ChartMatrix;
                    t           = this._Scope.GetType();
                }

                if (t == typeof(Grouping))
                {
                    bSave = false;
                    Grouping g = (Grouping)(this._Scope);
                    if (g.InMatrix)
                    {
                        Rows rows = g.GetRows(rpt);
                        if (rows == null)
                        {
                            return(null);
                        }
                        re = new RowEnumerable(0, rows.Data.Count - 1, rows.Data, _LevelCheck);
                    }
                    else
                    {
                        if (row == null || row.R.CurrentGroups == null)                             // currentGroups can be null when reference Textbox in header/footer that has a scoped aggr function reference (TODO: this is a problem!)
                        {
                            return(null);
                        }
                        GroupEntry ge = row.R.CurrentGroups[g.GetIndex(rpt)];
                        re = new RowEnumerable(ge.StartRow, ge.EndRow, row.R.Data, _LevelCheck);
                    }
                }
                else if (t == typeof(Matrix))
                {
                    bSave = false;
                    Matrix m     = (Matrix)(this._Scope);
                    Rows   mData = m.GetMyData(rpt);
                    re = new RowEnumerable(0, mData.Data.Count - 1, mData.Data, false);
                }
                else if (t == typeof(string))
                {                       // happens on page header/footer scope
                    if (row != null)
                    {
                        re = new RowEnumerable(0, row.R.Data.Count - 1, row.R.Data, false);
                    }
                    bSave = false;
                }
                else if (row != null)
                {
                    re = new RowEnumerable(0, row.R.Data.Count - 1, row.R.Data, false);
                }
                else
                {
                    DataSetDefn ds = this._Scope as DataSetDefn;
                    if (ds != null && ds.Query != null)
                    {
                        Rows rows = ds.Query.GetMyData(rpt);
                        if (rows != null)
                        {
                            re = new RowEnumerable(0, rows.Data.Count - 1, rows.Data, false);
                        }
                    }
                }
            }
            else if (row != null)
            {
                re = new RowEnumerable(0, row.R.Data.Count - 1, row.R.Data, false);
            }

            return(re);
        }
Esempio n. 8
0
 public RowEnumerator(RowEnumerable rea)
 {
     re = rea;
 }
Esempio n. 9
0
		// return an IEnumerable that represents the scope of the data
		protected RowEnumerable GetDataScope(Report rpt, Row row, out bool bSave)
			{
			bSave=true;
			RowEnumerable re=null;

			if (this._Scope != null)
			{
				Type t = this._Scope.GetType();

                //150208AJM GJL Trying - And Succeeding!!! to get data from chart
                if (t == typeof(Chart)) {
                    Chart c = (Chart)this._Scope;
                    this._Scope = c.ChartMatrix;
                    t = this._Scope.GetType();
                }

				if (t == typeof(Grouping))
				{
					bSave=false;
					Grouping g = (Grouping) (this._Scope);
					if (g.InMatrix)
					{
						Rows rows = g.GetRows(rpt);
						if (rows == null)
							return null;
						re = new RowEnumerable(0, rows.Data.Count-1, rows.Data, _LevelCheck);
					}
					else
					{
						if (row == null || row.R.CurrentGroups == null)     // currentGroups can be null when reference Textbox in header/footer that has a scoped aggr function reference (TODO: this is a problem!)
							return null;
						GroupEntry ge = row.R.CurrentGroups[g.GetIndex(rpt)];
						re = new RowEnumerable (ge.StartRow, ge.EndRow, row.R.Data, _LevelCheck);
					}
				}
				else if (t == typeof(Matrix))
				{
					bSave=false;
					Matrix m = (Matrix) (this._Scope);
					Rows mData = m.GetMyData(rpt);
					re = new RowEnumerable(0, mData.Data.Count-1, mData.Data, false);
				}
				else if (t == typeof(string))
				{	// happens on page header/footer scope
					if (row != null)
						re = new RowEnumerable (0, row.R.Data.Count-1, row.R.Data, false);
					bSave = false;
				}
                else if (t == typeof(DataSetDefn))
                {
                    DataSetDefn ds = this._Scope as DataSetDefn;
                    if (ds != null && ds.Query != null)
                    {
                        Rows rows = ds.Query.GetMyData(rpt);
                        if (rows != null)
                            re = new RowEnumerable(0, rows.Data.Count - 1, rows.Data, false);
                    }
                }
				else if (row != null)
				{
					re = new RowEnumerable (0, row.R.Data.Count-1, row.R.Data, false);
				}
                else
				{
					DataSetDefn ds = this._Scope as DataSetDefn;
					if (ds != null && ds.Query != null)
					{
						Rows rows = ds.Query.GetMyData(rpt);
						if (rows != null)
							re = new RowEnumerable(0, rows.Data.Count-1, rows.Data, false);
					}
				}
			}
			else if (row != null)
			{
				re = new RowEnumerable (0, row.R.Data.Count-1, row.R.Data, false);
			}

			return re;
		}
Esempio n. 10
0
		public RowEnumerator(RowEnumerable rea)
		{
			re = rea;
		}
Esempio n. 11
0
        // return an IEnumerable that represents the scope of the data
        protected RowEnumerable GetDataScope(Report rpt, Row row, out bool bSave)
        {
            bSave = true;
            RowEnumerable re = null;

            if (this._Scope != null)
            {
                Type t = this._Scope.GetType();
                if (t == typeof(Grouping))
                {
                    bSave = false;
                    Grouping g = (Grouping)(this._Scope);
                    if (g.InMatrix)
                    {
                        Rows rows = g.GetRows(rpt);
                        if (rows == null)
                        {
                            return(null);
                        }
                        re = new RowEnumerable(0, rows.Data.Count - 1, rows.Data, _LevelCheck);
                    }
                    else
                    {
                        if (row == null)
                        {
                            return(null);
                        }
                        GroupEntry ge = row.R.CurrentGroups[g.GetIndex(rpt)];
                        re = new RowEnumerable(ge.StartRow, ge.EndRow, row.R.Data, _LevelCheck);
                    }
                }
                else if (t == typeof(Matrix))
                {
                    bSave = false;
                    Matrix m     = (Matrix)(this._Scope);
                    Rows   mData = m.GetMyData(rpt);
                    re = new RowEnumerable(0, mData.Data.Count - 1, mData.Data, false);
                }
                else if (t == typeof(string))
                {                       // happens on page header/footer scope
                    if (row != null)
                    {
                        re = new RowEnumerable(0, row.R.Data.Count - 1, row.R.Data, false);
                    }
                    bSave = false;
                }
                else if (row != null)
                {
                    re = new RowEnumerable(0, row.R.Data.Count - 1, row.R.Data, false);
                }
                else
                {
                    DataSetDefn ds = this._Scope as DataSetDefn;
                    if (ds != null && ds.Query != null)
                    {
                        Rows rows = ds.Query.GetMyData(rpt);
                        if (rows != null)
                        {
                            re = new RowEnumerable(0, rows.Data.Count - 1, rows.Data, false);
                        }
                    }
                }
            }
            else if (row != null)
            {
                re = new RowEnumerable(0, row.R.Data.Count - 1, row.R.Data, false);
            }

            return(re);
        }
Esempio n. 12
0
		// return an IEnumerable that represents the scope of the data
		protected RowEnumerable GetDataScope(Report rpt, Row row, out bool bSave)
			{
			bSave=true;
			RowEnumerable re=null;

			if (this._Scope != null)
			{
				Type t = this._Scope.GetType();
				if (t == typeof(Grouping))
				{
					bSave=false;
					Grouping g = (Grouping) (this._Scope);
					if (g.InMatrix)
					{
						Rows rows = g.GetRows(rpt);
						if (rows == null)
							return null;
						re = new RowEnumerable(0, rows.Data.Count-1, rows.Data, _LevelCheck);
					}
					else
					{
						if (row == null)
							return null;
						GroupEntry ge = row.R.CurrentGroups[g.GetIndex(rpt)];
						re = new RowEnumerable (ge.StartRow, ge.EndRow, row.R.Data, _LevelCheck);
					}
				}
				else if (t == typeof(Matrix))
				{
					bSave=false;
					Matrix m = (Matrix) (this._Scope);
					Rows mData = m.GetMyData(rpt);
					re = new RowEnumerable(0, mData.Data.Count-1, mData.Data, false);
				}
				else if (t == typeof(string))
				{	// happens on page header/footer scope
					if (row != null)
						re = new RowEnumerable (0, row.R.Data.Count-1, row.R.Data, false);
					bSave = false;
				}
				else if (row != null)
				{
					re = new RowEnumerable (0, row.R.Data.Count-1, row.R.Data, false);
				}
				else
				{
					DataSetDefn ds = this._Scope as DataSetDefn;
					if (ds != null && ds.Query != null)
					{
						Rows rows = ds.Query.GetMyData(rpt);
						if (rows != null)
							re = new RowEnumerable(0, rows.Data.Count-1, rows.Data, false);
					}
				}
			}
			else if (row != null)
			{
				re = new RowEnumerable (0, row.R.Data.Count-1, row.R.Data, false);
			}

			return re;
		}