Hi,
Is there a way to hide Half Year(H1, H2) and Quarter(Q1, Q2, etc) from date dimension in xamPivotGrid? We only want to show year, month, and day info for a date type dimension.
Thanks,
Joseph
Hi
You should create your own HierarchyDescriptor and exclude the levels that you dont want to be visible. Below is a snipet
HierarchyDescriptor dateTimeDescriptor = new HierarchyDescriptor { AppliesToPropertiesOfType = typeof(DateTime) }; dateTimeDescriptor.AddLevel<DateTime>(dt => SR.GetString("AllPeriods"), "All Periods"); dateTimeDescriptor.AddLevel<DateTime>(dt => dt.Year, "Years"); dateTimeDescriptor.AddLevel<DateTime>(dt => dt.SemesterShort(), "Semesters"); dateTimeDescriptor.AddLevel<DateTime>(dt => dt.QuarterShort(), "Quarters"); dateTimeDescriptor.AddLevel<DateTime>(dt => dt.MonthShort(), "Months");
pivotGrid.DataSource.HierarchyDescriptors.Add(dateTimeDescriptor);
RegardsTodor
Do you have a sample somewhere that shows how to do this in the XAML code?
Hello,
I believe that this is already discussed here:
http://ko.infragistics.com/community/forums/p/81112/409700.aspx#409700
Thanks for the response Stefan,
I've already gone through that page before. I was more interested in doing the XAML version of what you just did in this thread for date hierarchy. Specifically renaming levels and removing the semester or the H.
Can you shed some light on it? I've tried experimenting on this and the following just makes the grid hang:
<olap:HierarchyDescriptor SourcePropertyName="DATE_COLLECTED" HierarchyDisplayName="Collection Date" > <olap:HierarchyDescriptor.LevelDescriptors> <olap:HierarchyLevelDescriptor LevelName="All Periods"/><olap:HierarchyLevelDescriptor LevelName="Year" LevelExpressionPath="Year"/><olap:HierarchyLevelDescriptor LevelName="Short Quarter" LevelExpressionPath="QuarterShort()"/><olap:HierarchyLevelDescriptor LevelName="Short Quarter" LevelExpressionPath="QuarterShort()"/><olap:HierarchyLevelDescriptor LevelName="Short Month" LevelExpressionPath="MonthShort()"/><olap:HierarchyLevelDescriptor LevelName="Day" LevelExpressionPath="DATE_COLLECTED"/></olap:HierarchyDescriptor.LevelDescriptors></olap:HierarchyDescriptor>
You can see how to define hierarchy descriptors in XAML here:
http://help.infragistics.com/Help/NetAdvantage/WPF/2013.1/CLR4.0/html/xamPivotGrid_US_Defining_Hierarchies_And_Providing_Metadata_With_FlatData.html