Hello,I'm testing the controls xamPivotGrid and xamPivotDataSelector with your example solution PivotGridHostControl(http://blogs.infragistics.com/blogs/kiril_matev/archive/2010/06/11/hosting-a-wpf-pivotgrid-delivering-advanced-data-analysis-in-your-windows-forms-application.aspx).
I Have a question:
I delete "Freight" from the "Drop Data Items Here" on the xamPivotGrid. Now I want drag the field "Freight"from xamPivotDataSelector to "Drop Data Items Here" on the xamPivotGrid (the same place, where previously the field "Freight" had existed) . But I can't drop there the field. I see a circle with a x. Why it doesn't work?
Alexander
Hello,
I can't find in this sample where the string values from "Amount of sale" added to Measures.
Please write where I can find the code.
Can I download the sample?
Thanks.
Alexander.
Hello,Here is explained how you can define your custom aggregator. Look for the attached CustomMeasureAggregator.zip.Also you can look at this sample where you can find how you can implement an aggregator which operates over data with type of string.
Let me know if you have any further questions.
Best regards.Plamen.
Yes. Only numeric columns can be included in the Measures.
Also I noticed something else. Measures don't have a hierarchy, so you just specify the name of the column within quotes. That is in the above code, assuming column RX4 [mg/l] is numeric, make the following change and you should see your measures populated.
Measures = DataSourceBase.GenerateInitialItems("RX4 [mg/l].RX4 [mg/l]")
Thanks
Sangeetha
Hi Kiril,thanks for your help.Yes, it is correct that I took the dimension Fright and not Freight measure. With the Fright measures I have no problems. It works fine.
But I have another problem. I have in the Measures group no items.
I use NetAdvantage 11.1 and the FlatDataSource.I have a DataTable with special column-caption (the signs: [, ] and space): "RX4 [mg/l]" or "TZE [g/ml]".So I can't use the code from the example PivotGridWinformsHosting; method loadNthwindInvoicesBtn_Click:var q = from data in odt select new { ... }
I take the example from Todor Karkelanov in the forum with the DynamicTypeBuilder: http://community.infragistics.com/forums/p/46138/248989.aspx#248989It works fine.
public void SetFlatDatasource(string displayName, DataTable dataTable) { DynamicTypeBuilder typeBuilder = new DynamicTypeBuilder { DynamicAssemblyName = "Test", DynamicTypeName = displayName };
IList<DynamicTypePropertyInfo> properties = new List<DynamicTypePropertyInfo>();
foreach (DataColumn column in dataTable.Columns) { DynamicTypePropertyInfo propertyInfo = new DynamicTypePropertyInfo { PropertyName = column.ColumnName, PropertyType = column.DataType };
properties.Add(propertyInfo); }
Type dynamicType = typeBuilder.GenerateType(properties);
Type listType = typeof(List<>);
Type genericListType = listType.MakeGenericType(dynamicType);
IList list = (IList)Activator.CreateInstance(genericListType);
foreach (DataRow dataRow in dataTable.Rows) { object myDynamicInstance = Activator.CreateInstance(dynamicType);
foreach (DataColumn column in dataTable.Columns) { PropertyInfo propertyVal = dynamicType.GetProperty(column.ColumnName);
if (dataRow[column] != DBNull.Value) propertyVal.SetValue(myDynamicInstance, dataRow[column], null); }
list.Add(myDynamicInstance); }
FlatDataSource flatDataSource = new FlatDataSource() { ItemsSource = list, Cube = DataSourceBase.GenerateInitialCube(displayName), Columns = FlatDataSource.GenerateInitialItems("[Test_NR].[Test_NR]"), Rows = FlatDataSource.GenerateInitialItems("[RECORD_NR].[RECORD_NR]"), Measures = DataSourceBase.GenerateInitialItems("RX4 [mg/l].RX4 [mg/l]") };
xamPivotGrid.DataSource = flatDataSource; xamPivotDataSelector.DataSource = flatDataSource; }
But the values from the columns "RX4 [mg/l]" or "TZE [g/ml]" are type of string. That is correct, becausethe values in these columns are:2,5E-04<0,5E-02>8,63E-04
I have read: I must have numeric values for measures. That's why I have no items in the Measures group.Is that correct?What can I do?
Thanks.Alexander
Hi Alexander,
Thank you for writing us.
The reason the pivot grid does not let you drop the Fright in the measures area, (hence the circle with an X), is that you're most probably dragging the dimension Freight, as opposed to the Freight measure, which appears in the Measures expandable group at the top of the list of measures and dimensions.
Please drag the Fright measure from the list of measures in the pivot data selector into the measures area in the pivot grid. This should produce the desired result.
Please see the places you can drag and drop the the Fright measure (blue) and the Freight dimension (red) in the screenshot below:
Let us know if you need any additional assistance.
Best,
Kiril