Hi,
I have a collection of one class which has "nested collection of another class" as its property. Consider following class for example,
public class SOHoldingUIEntity { public StockOptimisationStockHoldingEntity soh { get; set; } public string group_header { get; set; } public ObservableCollection<StockOptimisationStockHoldingItemEntity> soitems { get; set; } public SOHoldingUIEntity() { soitems = new ObservableCollection<StockOptimisationStockHoldingItemEntity>(); } }
I need to display pivot using Observable Collection of SOHoldingUIEntity class (using flat data source). How to bring up properties of StockOptimisationStockHoldingEntity in pivot data selector?
Has anyone created such pivot? Could someone please help me on this?
Thanks in advance...
Hi rohanb,
You can access nested properties in the HierarchyDescriptor.
I'm not sure what you want to do with that data. We do support Hierarchy in our Grid control, so if you want to display your data you can use this control.
If you want to use the analysis functionality of the PivotGrid you can flatten the data and create new IEnumerable.
I would recommend to do that using LINQ or if not possible in your case you can do custom Enumerator, so to not duplicate all of the data. You can use functions in the HierarchyDescriptor.
Thanks,
George
Were you able to resolve your issue?
Hi George,
No, I could not resolve my issue with HierarchyDescriptor as suggested by you. I don't think HierarchyDescriptor will be of any use here.
On all other pivots I've developed; I'm getting data in observable collection of some class and I simply add all it's properties in CubeMetadata object as follows:
CubeMetadata cubeMetadataValues = new CubeMetadata(); cubeMetadataValues.DisplayName = "cubeMetaDataDisplayName"; cubeMetadataValues.DataTypeFullName = typeof(<MyClassName>).FullName;
And then, I simply add properties as follows:
cubeMetadataValues.DimensionSettings.Add(new DimensionMetadata() { SourcePropertyName = "RetailProductID", DisplayName = "Product", DimensionType = DimensionType.Dimension, GroupName = "Product" });
cubeMetadataValues.DimensionSettings.Add(new DimensionMetadata() { SourcePropertyName = "Color", DisplayName = "Color", DimensionType = DimensionType.Dimension, GroupName = "Product" }); cubeMetadataValues.DimensionSettings.Add(new DimensionMetadata() { SourcePropertyName = "Description", DisplayName = "Description", DimensionType = DimensionType.Dimension, GroupName = "Product" });
This way, all the properties are listed in Pivot's data selector control.
My problem gets complicated when I get data in observable collection of type similar to this:
public class SOHoldingUIEntity{ public StockOptimisationStockHoldingEntity soh { get; set; } public string group_header { get; set; } public ObservableCollection<StockOptimisationStockHoldingItemEntity> soitems { get; set; } public SOHoldingUIEntity() { soitems = new ObservableCollection<StockOptimisationStockHoldingItemEntity>(); }}
And I want to add all the properties of "StockOptimisationStockHoldingEntity" (in above class) to CubeMetadata object to get them on Pivot's data selector. I am not able to understand how to create custom Enumerator using LINQ, as you said, and use it to generate pivot. Since I've to specify the fully qualified assembly name or class name in the statement => cubeMetadataValues.DataTypeFullName = dataTypeFullName;
Again, I am not willing to create Hierarchy of properties of "StockOptimisationStockHoldingEntity" class. I just wanted to list them all one below the other in pivot's data selector. User of the pivot can drag-n-drop any dimension/measure to pivot to see the analysis.
I have tried to explain my problem in details here. I hope you get that! Let me know if you further need any clarification.
Thanks once again for your time...
Cheers,
Rohan
Hi Rohan,
Attached you can find a solution with "flatten" data.
Thanks a lot for your help. I tried the approach you've suggested in sample solution and it worked exactly in a way I wanted...
Thanks once again... :)
Regards,