/// <summary>
        /// Initializes a new instance of the <see cref="AnalysisRow"/> class.
        /// </summary>
        /// <param name="result">Result</param>
        /// <param name="categoryValue">Category value</param>
        public AnalysisRow(AnalysisResult result, AnalysisProcessingYCategoryValue categoryValue)
        {
            var values = new List <object>();
            int i, count = result.Columns.Count;

            for (i = 0; i < count; i++)
            {
                AnalysisProcessingResultColumnValue rcv = categoryValue.ResultColumnValues[i];
                AnalysisResultCell cell = new AnalysisResultCell(rcv, this, result.Columns[i] as AnalysisColumn);
                values.Add(cell);
            }

            this.Key        = categoryValue.Key;
            this.Values     = values;
            this.Label      = categoryValue.Label;
            this.ResultRows = categoryValue.ResultRows;
            this.Result     = result;
            if (categoryValue.Category.SubCategoryName?.Length > 0)
            {
                AnalysisDrilldownOption opt = new AnalysisDrilldownOption(result.Analysis, categoryValue.Category.Category.BaseField(), categoryValue.Category.SubCategoryName);
                if (opt != null)
                {
                    this.AddDrilldownOption(opt);
                }
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="AnalysisResultCell"/> class.
        /// </summary>
        /// <param name="value">Value.AnalysisValueFunction</param>
        /// <param name="row">Row</param>
        /// <param name="column">Column</param>
        public AnalysisResultCell(AnalysisProcessingResultColumnValue value, AnalysisRow row, AnalysisColumn column)
        {
            this.Row    = row;
            this.Column = column;
            if (this.Column.ResultColumn.ValueOptions?.IsText ?? false)
            {
                this.StringValue = value.TextResult;
                this.RawValue    = this.StringValue;
                this.Value       = 0;
                var xCategoryValues = column.XCategoryValues;
                if (xCategoryValues.Count > 0)
                {
                    var xResultCells = new List <AnalysisXResultCell>();
                    foreach (AnalysisXColumn xCategoryValue in xCategoryValues)
                    {
                        xResultCells.Add(new AnalysisXResultCell(value.TextResultForXCategoryValueKey(xCategoryValue.Key)));
                    }

                    this.XResultCells = xResultCells;
                }
            }
            else
            {
                this.Value       = value.Result;
                this.StringValue = column.ResultColumn.DisplayStringFromNumber(this.Value);
                this.RawValue    = this.Value.ToString();
                var xCategoryValues = column.XCategoryValues;
                if (xCategoryValues?.Count > 0)
                {
                    var xResultCells = new List <AnalysisXResultCell>();
                    foreach (AnalysisXColumn xCategoryValue in xCategoryValues)
                    {
                        var num = value.ResultForXCategoryValueKey(xCategoryValue.Key);
                        xResultCells.Add(new AnalysisXResultCell(num, column.ResultColumn.DisplayStringFromNumber(num)));
                    }

                    this.XResultCells = xResultCells;
                }
            }
        }