/// <summary> /// String values for result row /// </summary> /// <param name="dataSourceRow">Data source row</param> /// <returns>List of string values for result row</returns> public List <string> StringValuesForResultRow(ICrmDataSourceRow dataSourceRow) { List <object> sourceFields = this.Result.DetailsFields; int sourceFieldCount = sourceFields.Count; List <string> stringArray = null; if (sourceFieldCount > 0) { stringArray = new List <string>(); foreach (object field in sourceFields) { if (field == null) { stringArray.Add(string.Empty); } else { AnalysisSourceField sourceField = (AnalysisSourceField)field; stringArray.Add(dataSourceRow.ValueAtIndex(sourceField.QueryResultFieldIndex)); } } } return(stringArray); }
/// <summary> /// Initializes a new instance of the <see cref="AnalysisSourceFieldResultColumn"/> class. /// </summary> /// <param name="field">Field</param> /// <param name="aggregationType">Aggregation type</param> public AnalysisSourceFieldResultColumn(AnalysisSourceField field, AnalysisAggregationType aggregationType) { this.AnalysisField = field; this.currentAggregationType = aggregationType; if (field.IsWeightDependent) { this.WeightField = field.Analysis.WeightField; } if (field.IsCurrencyDependent) { this.CurrencyField = field.AnalysisTable.AlternateCurrencyField ?? field.Analysis.CurrencyField; } }
/// <summary> /// Initializes a new instance of the <see cref="AnalysisSourceFieldResultColumn"/> class. /// </summary> /// <param name="field">Analysis source field</param> public AnalysisSourceFieldResultColumn(AnalysisSourceField field) : this(field, AnalysisAggregationType.GetSum()) { }
/// <summary> /// Initializes a new instance of the <see cref="AnalysisFunctionSimpleTextField"/> class. /// </summary> /// <param name="field">Field</param> /// <param name="analysis">Analysis</param> public AnalysisFunctionSimpleTextField(AnalysisSourceField field, Analysis analysis) : base(field, analysis) { }
private AnalysisFunctionFormulaParseResult ParseVariable(AnalysisParserString parserString) { if (!parserString.CurrentString.StartsWith("$")) { return(new AnalysisFunctionFormulaParseResult("invalid function token")); } parserString.SkipChar(); bool isTextFunction = false; if (parserString.NextCharacter() == '!') { isTextFunction = true; parserString.SkipChar(); } string functionName = parserString.NextWord(); parserString.SkipBlanks(); if (!isTextFunction) { AnalysisFunction func = AnalysisFunction.FunctionWithName(functionName); if (func != null) { if (parserString.NextCharacter() == '(') { parserString.SkipCharWithBlanks(); AnalysisFunctionFormulaParseResult parseResult = this.Parse(parserString); if (parseResult.Result != null) { AnalysisFunctionFunc f = new AnalysisFunctionFunc(func, parseResult.Result, this.Analysis); if (parserString.NextCharacter() == ')') { parserString.SkipCharWithBlanks(); return(new AnalysisFunctionFormulaParseResult(f)); } else { return(new AnalysisFunctionFormulaParseResult("invalid function end")); } } } } } string indexPart0 = parserString.IndexString(); string indexPart1 = null; if (indexPart0 != null) { indexPart1 = parserString.IndexString(); } int occurrence = 0; if (indexPart1?.Length > 0) { occurrence = indexPart0.ToInt(); indexPart0 = indexPart1; } bool record = false; int fieldNumber = -1; if (indexPart0 != null) { if (indexPart0 == "r") { record = true; } fieldNumber = indexPart0.ToInt(); } else { record = true; } AnalysisTable table = this.Analysis.TableWithInfoAreaIdOccurrence(functionName, occurrence); if (table == null) { return(new AnalysisFunctionFormulaParseResult($"unknown table {functionName}/{occurrence}")); } if (record) { AnalysisFunctionInfoAreaField f = new AnalysisFunctionInfoAreaField(table.CountField(), this.Analysis); return(new AnalysisFunctionFormulaParseResult(f)); } AnalysisSourceField sourceField = table.FieldWithIndex(fieldNumber); if (sourceField == null) { return(new AnalysisFunctionFormulaParseResult($"unknown field {functionName}/{occurrence}.{fieldNumber}")); } AnalysisFunctionSimpleField functionField; if (isTextFunction) { functionField = new AnalysisFunctionSimpleTextField(sourceField, this.Analysis); } else { functionField = new AnalysisFunctionSimpleNumberField(sourceField, this.Analysis); } return(new AnalysisFunctionFormulaParseResult(functionField)); }
/// <summary> /// Initializes a new instance of the <see cref="AnalysisFunctionSimpleField"/> class. /// </summary> /// <param name="field">Field</param> /// <param name="analysis">Analysis</param> public AnalysisFunctionSimpleField(AnalysisSourceField field, Analysis analysis) : base(analysis) { this.SourceField = field; }
/// <summary> /// Initializes a new instance of the <see cref="AnalysisDrillThruColumn"/> class. /// </summary> /// <param name="sourceField">Source field</param> /// <param name="dataSourceField">Data source field</param> public AnalysisDrillThruColumn(AnalysisSourceField sourceField, ICrmDataSourceField dataSourceField) { this.SourceField = sourceField; this.DataSourceField = dataSourceField; }