예제 #1
0
        void ResolveNestedDataRegions()
        {
            ReportLink rl = this.Parent;

            while (rl != null)
            {
                if (rl is DataRegion)
                {
                    this._ParentDataRegion = rl as DataRegion;
                    break;
                }
                rl = rl.Parent;
            }
            return;
        }
예제 #2
0
        public void DataRegionNoRows(DataRegion d, string noRowsMsg)                            // no rows in table
        {
            if (noRowsMsg == null)
            {
                noRowsMsg = "";
            }

            bool bTableCell = d.Parent.Parent.GetType() == typeof(TableCell);

            DoStyle(d.Style, null);
            tw.Write(noRowsMsg);
            if (bTableCell)
            {
                tw.Write(@"\cell");
            }
        }
예제 #3
0
 public void DataRegionNoRows(DataRegion t, string noRowMsg)
 {
 }
예제 #4
0
 public void DataRegionNoRows(DataRegion d, string noRowsMsg)
 {
 }
예제 #5
0
        override internal void FinalPass()
        {
            // optimization: avoid expression overhead if this isn't really an expression
            if (_Source == null)
            {
                _Expr = new Constant <string>("");                //Originally Plain Constant
                return;
            }
            else if (_Source == "" ||                   // empty expression
                     _Source[0] != '=')                 // if 1st char not '='
            {
                //Originally Plain Constant
                _Expr = new Constant <string>(_Source);                 //   this is a constant value
                return;
            }

            Parser p = new Parser(OwnerReport.DataCache);

            // find the fields that are part of the DataRegion (if there is one)
            IDictionary fields = null;
            ReportLink  dr     = Parent;
            Grouping    grp    = null;                  // remember if in a table group or detail group or list group
            Matrix      m      = null;
            ReportLink  phpf   = null;

            while (dr != null) // Loops through Report Items and their
            {                  // parents until the group that contains it is obtained.
                if (dr is Grouping)
                {
                    p.NoAggregateFunctions = true;
                }
                else if (dr is TableGroup)
                {
                    grp = ((TableGroup)dr).Grouping;
                }
                else if (dr is Matrix)
                {
                    m = (Matrix)dr;                                     // if matrix we need to pass special
                    break;
                }
                else if (dr is Details)
                {
                    grp = ((Details)dr).Grouping;
                }
                else if (dr is List)
                {
                    grp = ((List)dr).Grouping;
                    break;
                }
                else if (dr is PageHeader || dr is PageFooter)
                {
                    phpf = dr;
                }
                else if (dr is DataRegion || dr is DataSetDefn)
                {
                    break;
                }
                dr = dr.Parent;
            }
            if (dr != null)
            {
                if (dr is DataSetDefn)
                {
                    DataSetDefn d = (DataSetDefn)dr;
                    if (d.Fields != null)
                    {
                        fields = d.Fields.Items;
                    }
                }
                else                    // must be a DataRegion
                {
                    DataRegion d = (DataRegion)dr;
                    if (d.DataSetDefn != null &&
                        d.DataSetDefn.Fields != null)
                    {
                        fields = d.DataSetDefn.Fields.Items;
                    }
                }
            }

            NameLookup lu = new NameLookup(fields, OwnerReport.LUReportParameters,
                                           OwnerReport.LUReportItems, OwnerReport.LUGlobals,
                                           OwnerReport.LUUser, OwnerReport.LUAggrScope,
                                           grp, m, OwnerReport.CodeModules, OwnerReport.Classes, OwnerReport.DataSetsDefn,
                                           OwnerReport.CodeType);

            if (phpf != null)
            {
                // Non-null when expression is in PageHeader or PageFooter;
                //   Expression name needed for dynamic lookup of ReportItems on a page.
                lu.PageFooterHeader = phpf;
                lu.ExpressionName   = _UniqueName = "xn_" + Interlocked.Increment(ref Parser.Counter).ToString();
            }

            try
            {
                _Expr = p.Parse(lu, _Source);
            }
            catch (Exception e)
            {
                _Expr = new Constant <string>(e.Message);                //Originally ConstantError
                // Invalid expression
                OwnerReport.rl.LogError(8, ErrorText(e.Message));
            }

            // Optimize removing any expression that always result in a constant
            try
            {
                _Expr = _Expr.ConstantOptimization();
            }
            catch (Exception ex)
            {
                OwnerReport.rl.LogError(4, "Expression:" + _Source + "\r\nConstant Optimization exception:\r\n" + ex.Message + "\r\nStack trace:\r\n" + ex.StackTrace);
            }
            _Type = _Expr.GetTypeCode();

            return;
        }
        internal TypeCode DoParse(Report rpt)
        {
            // optimization: avoid expression overhead if this isn't really an expression
            if (_Source == null)
            {
                _Expr = new Constant <string>(""); //Originally Plain Constant
                return(_Expr.GetTypeCode());
            }
            else if (_Source == string.Empty ||         // empty expression
                     _Source[0] != '=')                 // if 1st char not '='
            {
                _Expr = new Constant <string>(_Source); //   this is a constant value
                return(_Expr.GetTypeCode());
            }

            Parser p = new Parser(new System.Collections.Generic.List <ICacheData>());

            // find the fields that are part of the DataRegion (if there is one)
            IDictionary fields = null;
            ReportLink  dr     = _rl.Parent;
            Grouping    grp    = null;                  // remember if in a table group or detail group or list group
            Matrix      m      = null;

            while (dr != null)
            {
                if (dr is Grouping)
                {
                    p.NoAggregateFunctions = true;
                }
                else if (dr is TableGroup)
                {
                    grp = ((TableGroup)dr).Grouping;
                }
                else if (dr is Matrix)
                {
                    m = (Matrix)dr;                                     // if matrix we need to pass special
                    break;
                }
                else if (dr is Details)
                {
                    grp = ((Details)dr).Grouping;
                }
                else if (dr is List)
                {
                    grp = ((List)dr).Grouping;
                    break;
                }
                else if (dr is DataRegion || dr is DataSetDefn)
                {
                    break;
                }
                dr = dr.Parent;
            }
            if (dr != null)
            {
                if (dr is DataSetDefn)
                {
                    DataSetDefn d = (DataSetDefn)dr;
                    if (d.Fields != null)
                    {
                        fields = d.Fields.Items;
                    }
                }
                else                    // must be a DataRegion
                {
                    DataRegion d = (DataRegion)dr;
                    if (d.DataSetDefn != null &&
                        d.DataSetDefn.Fields != null)
                    {
                        fields = d.DataSetDefn.Fields.Items;
                    }
                }
            }

            NameLookup lu = new NameLookup(fields, rpt.ReportDefinition.LUReportParameters,
                                           rpt.ReportDefinition.LUReportItems, rpt.ReportDefinition.LUGlobals,
                                           rpt.ReportDefinition.LUUser, rpt.ReportDefinition.LUAggrScope,
                                           grp, m, rpt.ReportDefinition.CodeModules, rpt.ReportDefinition.Classes, rpt.ReportDefinition.DataSetsDefn,
                                           rpt.ReportDefinition.CodeType);

            try
            {
                _Expr = p.Parse(lu, _Source);
            }
            catch (Exception e)
            {
                _Expr = new Constant <string>(e.Message); //Originally ConstantError
                // Invalid expression
                rpt.rl.LogError(8, ErrorText(e.Message));
            }

            // Optimize removing any expression that always result in a constant
            try
            {
                _Expr = _Expr.ConstantOptimization();
            }
            catch (Exception ex)
            {
                rpt.rl.LogError(4, "Expression:" + _Source + "\r\nConstant Optimization exception:\r\n" + ex.Message + "\r\nStack trace:\r\n" + ex.StackTrace);
            }

            return(_Expr.GetTypeCode());
        }
예제 #7
0
 public void DataRegionNoRows(DataRegion d, string noRowsMsg)                    // no rows in table
 {
 }