I am just using the trial license and evaluating the pivot grid. Actually I ve been waiting for something like this for a while, and it looks pretty good.
The data that need to use it for is largely unknown at design time, meanly it is dynamically generated by the user, so what I get is a colletion of some object type or other. Therefore, I am using the Flat Data Source to just take the user generated data and binding it to the pivot grid so that they can report on it. I include the pivot data selector so that the user can do the normal types of slicing and dicing....
First question, when one of the properties is a date, the pivot grid generates all the normal grouping properties, like years, quarters, months days etc..... Is there a way for the user to select just the types of groupings to include in the data selector. So lets say the user just wants to see the data grouped by year and month, but not the other items. My instinct was to grab the Years dimension in the selector and drag it down to the rows box, however, when I do this, it adds the whole date dimension including all the subdimensions.....
Second question, when the property is a DateTime? and not a DateTime, it does not generate all the subdimensions, meaning it doesnt look like the user can group by year or month..... Is there a reason for that? I suppose I could add those sub dimensions into the hierarchy programmatically, but it would require using reflection to generate a default set for each property.....
Thanks
-brent
The reason by we internally support that grouping for properties of type DataTime is we know the structure of the data found in the property. Adding a new hierarchy descriptor for that property will override the default behavior so you can create your own groupings:
HierarchyDescriptor dateTimeDataDescriptor =
new HierarchyDescriptor { AppliesToPropertiesOfType = typeof(DateTime) };
dateTimeDataDescriptor.AddLevel<DateTime>(date => "All Dates", "All Dates");
dateTimeDataDescriptor.AddLevel<DateTime>(date => date.Year, "Years");
dateTimeDataDescriptor.AddLevel<DateTime>(date => date.MonthShort()
, "Months");
dateTimeDataDescriptor.AddLevel<DateTime>(date => date.Date, "Members");
flatDataSource.AddHierarchyDescriptor(dateTimeDataDescriptor);
Created in this way it will be relevant for all DateTime properties. In the lambda also is possible to make calls to extension or instance methods. Here MonthShort() is extension method that returns the name of the month. The result of these calls will determine the variety of the members you’ll get for each level.
At this time only one hierarchy is supported for a dimension (property). Grabbing Years in this case wouldn’t work because here Years is just one of the levels of that hierarchy.
Plamen.
How can we sort by this new HierarchyDescriptor ?