Exemplo n.º 1
0
        Rows GetNestedData(Report rpt, Row row)
        {
            if (row == null)
            {
                return(null);
            }

            ReportLink rl = this.Parent;

            while (rl != null)
            {
                if (rl is TableGroup || rl is List || rl is MatrixCell)
                {
                    break;
                }
                rl = rl.Parent;
            }
            if (rl == null)
            {
                return(null);                                   // should have been caught as an error
            }
            Grouping g = null;

            if (rl is TableGroup)
            {
                TableGroup tg = rl as TableGroup;
                g = tg.Grouping;
            }
            else if (rl is List)
            {
                List l = rl as List;
                g = l.Grouping;
            }
            else if (rl is MatrixCell)
            {
                MatrixCellEntry mce = this.GetMC(rpt);
                return(new Rows(rpt, mce.Data));
            }
            if (g == null)
            {
                return(null);
            }

            GroupEntry ge = row.R.CurrentGroups[g.GetIndex(rpt)];

            return(new Rows(rpt, row.R, ge.StartRow, ge.EndRow, null));
        }
Exemplo n.º 2
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);
        }