Hello,I create a new message with a meaningful title.
My problem are values as string, which I need as Measures. In my example (see attached) is that the column "EK [ml/g]" with the values "<4.98E-05", "1.07E-06" or ">3.07E-07".
Now I have looked for a solution in the forum or in "Features & Samples". But I can't find a solution for the problem.Therefore in the annex my example (DataTable with values and FlatDataSource).It would be very good if somebody helps me:
1. I need the column (type string) "EK [ml/g]" for Measures.2. The column (type int) "TestNo" not displayed as Measures.
I would appreciate about example code.
Thanks.
Alexander
Hi
You should use cube settings to discribe your dimension metadata.
flatDataSource.DimensionsGenerationMode = DimensionsGenerationMode.Mixed; CubeMetadata cm = new CubeMetadata { DataTypeFullName = dynamicType.FullName }; DimensionMetadata dmd = new DimensionMetadata { SourcePropertyName = "TestNo", DimensionType = DimensionType.Dimension, DisplayName = "Test No", }; cm.DimensionSettings.Add(dmd); dmd = new DimensionMetadata { //GroupName = "group", SourcePropertyName = "EK [ml/g]", DimensionType = DimensionType.Measure, DisplayName = "EK measure", AutoGenerateField=true, Aggregator= new CountAggregator() //Aggregator = new CustomMeasureAggregator(this._flatSource) }; cm.DimensionSettings.Add(dmd); flatDataSource.CubesSettings.Add(cm);
You can hide the TestNo when you set its DimensionType to measure. About EK[ml/g] you shoud set its agregator, because the control should know how to deal with strings inside it.
RegardsTodor
Hi Todor,thanks for your help.That was a great help!
But the values in the xamPivotGrid are not the same in the dataTable from the column "EK [ml/g]".If you look at the picture, then you see the difference.What I must do to get the values from the dataTable (<4.52 or 5.51E-05)?
Thanks.Alexander
As I wrote before you should use aggregator in order to show no numeric data in pivot grid. In sample above I use CountAggregator for this measure and that is why "1' values appears. So to show pure string values you should wirte custorm aggregator. Below is a snippet how to do it.
In the implementation of Evaluate you should write your logic for displayed values.
using System; using System.Collections.Generic; using Infragistics.Olap; namespace PivotGrid_11._1_WPF { public class StringAggregator : Aggregator<string> { public override IAggregationResult<string, string> Evaluate(IAggregationResult<string, string> oldResult, string value) { throw new NotImplementedException(); } public override IAggregationResult<string, string> Evaluate(IAggregationResult<string, string> oldResult, IAggregateable aggregateable, System.Collections.IEnumerable items) { IList<string> values = new List<string>(); string retValue = ""; foreach (var item in items) { string value = (string)aggregateable.GetValue(item); values.Add(value); retValue += value; } // process values in oreder to get the result return new SingleResult<string>(retValue); } } }
Here is how to change measure metadata
dmd = new DimensionMetadata { //GroupName = "group", SourcePropertyName = "EK [ml/g]", DimensionType = DimensionType.Measure, DisplayName = "EK measure", AutoGenerateField = true, Aggregator = new StringAggregator() };
Todor
Hi Plamen,you are absolutely right. That was my mistake. Sorry.At first I have set DimensionType = DimensionType.Measure and later DimensionType = DimensionType.Dimension.
That is the correct question:What I must do, that for example the column "RecordNo" (type int) are not displayed; not as DimensionType.Measure and not as DimensionType.Dimension?
How can I rename the caption "Measures"?