示例#1
0
        // Handle parsing of function in final pass
        override internal void FinalPass()
        {
            base.FinalPass();
            _Value.FinalPass();

            //The Changes below were added from Forum, User: solidstate http://www.fyireporting.com/forum/viewtopic.php?t=905
            if (this.DataElementName == null && this.Name == null)
            {
                // no name or dataelementname; try using expression
                FunctionField ff = _Value.Expr as FunctionField;
                if (ff != null && ff.Fld != null)
                {
                    this.DataElementName = ff.Fld.DataField;
                    this.Name            = ff.Fld.Name; // Added
                }

                //Added
                FunctionAggr fa = _Value.Expr as FunctionAggr;
                if (fa != null)
                {
                    FunctionField ff2 = fa.Expr as FunctionField;
                    if (ff2 != null && ff2.Fld != null)
                    {
                        this.DataElementName = ff2.Fld.DataField;
                        this.Name            = ff2.Fld.Name;
                    }
                } //End Add
            }

            if (_ToggleImage != null)
            {
                _ToggleImage.FinalPass();
            }

            if (_HideDuplicates != null)
            {
                object o = OwnerReport.LUAggrScope[_HideDuplicates];
                if (o == null)
                {
                    OwnerReport.rl.LogError(4, "HideDuplicate '" + _HideDuplicates + "' is not a Group or DataSet name.   It will be ignored.");
                    _HideDuplicates = null;
                }
                else if (o is Grouping)
                {
                    Grouping g = o as Grouping;
                    g.AddHideDuplicates(this);
                }
                else if (o is DataSetDefn)
                {
                    DataSetDefn ds = o as DataSetDefn;
                    ds.AddHideDuplicates(this);
                }
            }
            return;
        }
        List <GroupEntry> _NestedGroup;         // group one hierarchy below

        internal GroupEntry(Grouping g, Sorting s, int start)
        {
            _Group       = g;
            _Sort        = s;
            _StartRow    = start;
            _EndRow      = -1;
            _NestedGroup = new List <GroupEntry>();

            // Check to see if grouping and sorting are the same
            if (g == null || s == null)
            {
                return;                                 // nothing to check if either is null
            }
            if (s.Items.Count != g.GroupExpressions.Items.Count)
            {
                return;
            }

            for (int i = 0; i < s.Items.Count; i++)
            {
                SortBy sb = s.Items[i] as SortBy;

                if (sb.Direction == SortDirectionEnum.Descending)
                {
                    return;                                     // TODO we could optimize this
                }
                FunctionField ff = sb.SortExpression.Expr as FunctionField;
                if (ff == null || ff.GetTypeCode() != TypeCode.String)
                {
                    return;
                }

                GroupExpression ge  = g.GroupExpressions.Items[i] as GroupExpression;
                FunctionField   ff2 = ge.Expression.Expr as FunctionField;
                if (ff2 == null || ff.Fld != ff2.Fld)
                {
                    return;
                }
            }
            _Sort = null;                       // we won't need to sort since the groupby will handle it correctly
        }