示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AnalysisExplicitCategoryField"/> class.
        /// </summary>
        /// <param name="analysis">Analysis</param>
        /// <param name="parentField">Parent field</param>
        /// <param name="categoryName">Category name</param>
        public AnalysisExplicitCategoryField(Analysis analysis, AnalysisField parentField, string categoryName)
            : base(analysis, $"{parentField.Key}({categoryName})")
        {
            this.categoryName = categoryName;
            UPConfigAnalysisCategory configCategory = ConfigurationUnitStore.DefaultStore.AnalysisCategoryByName(this.categoryName);

            if (configCategory == null)
            {
                return;
            }

            this.ParentField = parentField;
            var field = this.ParentField as AnalysisExplicitCategoryField;

            this.SourceField = field != null ? field.SourceField : this.ParentField;

            this.ExplicitCategory = this.SourceField.IsDateValue
                                    ? new AnalysisExplicitDateCategory(analysis, configCategory)
                                    : new AnalysisExplicitCategory(analysis, configCategory);
        }
示例#2
0
        /// <summary>
        /// Result column with table number field
        /// </summary>
        /// <param name="tableNumber">Table number</param>
        /// <param name="fieldId">Field id</param>
        /// <returns>Result column</returns>
        public AnalysisResultColumn ResultColumnWithTableNumberFieldId(int tableNumber, int fieldId)
        {
            string key;

            if (fieldId < 0)
            {
                AnalysisTable table = this.TableWithNumber(tableNumber);
                key = table.Key;
            }
            else
            {
                AnalysisField field = this.FieldWithTableNumberFieldId(tableNumber, fieldId);
                key = field.Key;
            }

            if (key?.Length > 0)
            {
                return(this.ResultColumnDictionary.ValueOrDefault(key) as AnalysisResultColumn);
            }

            return(null);
        }