示例#1
0
        IDictionary _Items; // dictionary of items

        #endregion Fields

        #region Constructors

        internal Fields(ReportDefn r, ReportLink p, XmlNode xNode)
            : base(r, p)
        {
            Field f;
            if (xNode.ChildNodes.Count < 10)
                _Items = new ListDictionary(StringComparer.CurrentCultureIgnoreCase);	// Hashtable is overkill for small lists
            else
                _Items = new Hashtable(xNode.ChildNodes.Count, StringComparer.CurrentCultureIgnoreCase);

            // Loop thru all the child nodes
            int iCol=0;
            foreach(XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                    continue;
                switch (xNodeLoop.Name)
                {
                    case "Field":
                        f = new Field(r, this, xNodeLoop);
                        f.ColumnNumber = iCol++;			// Assign the column number
                        break;
                    default:
                        f=null;
                        r.rl.LogError(4, "Unknown element '" + xNodeLoop.Name + "' in fields list.");
                        break;
                }
                if (f != null)
                {
                    if (_Items.Contains(f.Name.Nm))
                    {
                        r.rl.LogError(4, "Field " + f.Name + " has duplicates.");
                    }
                    else
                        _Items.Add(f.Name.Nm, f);
                }
            }
        }
 /// <summary>
 /// Determine if value of Field is available
 /// </summary>
 public FunctionFieldIsMissing(Field fld)
     : base(fld)
 {
 }
        private string _Name; // when we have an unresolved field;

        #endregion Fields

        #region Constructors

        /// <summary>
        /// obtain value of Field
        /// </summary>
        public FunctionField(Field fld)
        {
            f = fld;
        }
        internal override void FinalPass()
        {
            _ds = OwnerReport.DataSetsDefn[this._DataSetName];
            if (_ds == null)
                OwnerReport.rl.LogError(8, "DataSetReference refers to unknown data set '" + _DataSetName + "'");
            else
            {
                _vField = _ds.Fields[_ValueField];
                if (_vField == null)
                    OwnerReport.rl.LogError(8, "ValueField refers to unknown field '" + _ValueField + "'");
                else
                {
                    if (_LabelField == null)
                        _lField = _vField;
                    else
                    {
                        _lField = _ds.Fields[_LabelField];
                        if (_lField == null)
                            OwnerReport.rl.LogError(8, "LabelField refers to unknown field '" + _LabelField + "'");
                    }
                }
            }

            return;
        }