Hi all,
I managed to retrieve relational data (from SQL Server) via FlatDataSource and to show them in a WinPivotGrid.
Yet, some attributes in my table are mis-recognised as measures: they are integer values, but aggregating them is of no use. So, these are not measures but dimensions!
It seems to me that all numeric values are considered as measures and all not-numeric values are considered as dimensions. This is just a guess, because an experimental cast to varchar for my integer attributes caused WinPivotGrid to offer them as dimensions. Back to integers, they were offered as measures...
Is there way to influence that? It should be me who decides which field is a measure and which is a dimension. :)
Thanks for any hint.
Martin
Hello Sahaja,
thanks, I'll give it a try. Looks promising.
Regards
Hello Martin,
There is a possibility of changing measures to hierarchies by handling the InitializeOlapAxisElementDescriptor event and using the OlapElementDescriptor property of the event arguments.
Please refer to the comments of OlapElementDescriptor on how to use this property.
#region OlapAxisElementDescriptor/// <summary>/// Returns or sets a reference to the OLAP element to be associated with this instance's/// <see cref="Infragistics.Olap.FlatData.OlapAxisElementDescriptorEventArgs.PropertyDescriptor">PropertyDescriptor</see>./// </summary>/// <remarks>/// <p class="body">/// At the entry point for a handler of this event, this property returns either a/// <see cref="Infragistics.Olap.FlatData.HierarchyDescriptor">HierarchyDescriptor</see>/// or/// <see cref="Infragistics.Olap.FlatData.MeasureDescriptor">MeasureDescriptor</see>/// instance, depending on whether the data type of the class member it represents/// is numeric (members whose type is numeric (int, double, decimal, etc.) are assumed/// to represent a/// <see cref="Infragistics.Olap.Core.Data.Measure">Measure</see>)./// </p>/// <p class="body">/// Setting this property to null effectively removes the corresponding class member/// from the data source, i.e., no axis element is created for that member./// </p>/// <p class="body">/// The default behavior, whereby numeric types become measureDescriptors and non-numeric types/// become hierarchies, can be overriden by simply assigning an instance of the desired/// type to this property. When a class member whose type is non-numeric is/// designated as a Measure, however, the default aggregation method is undefined,/// and cells for that measure appear empty by default. This behavior can be overridden/// by handling the/// <see cref="Infragistics.Olap.FlatData.FlatDataSource.AggregateMeasure">AggregateMeasure</see>/// event, and manually aggregating the items therein./// </p>/// </remarks>public OlapAxisElementDescriptorBase OlapElementDescriptor{ get; set;}#endregion OlapAxisElementDescriptor
Please let me know if I may be of further assistance.
Sincerely,Sahaja KokkalagaddaAssociate Software Developer