I'm currently sat, bored, in a hotel room and figured now would be a good time to address my chronic lack of blogging lately. In my defence I have been on holiday!
Anyway, I've been reviewing the sample CalenderTransform componentas provided by Microsoft. More accurately, it was provided by a very smart guy by the name of Grant Dickinson.
Here Grant has provided a transformation component that takes an incoming DT_DATE or DT_DBTIMESTAMP column and from it creates a dataset of information about each incoming date value such as:
and a multitude of other attributes that you will doubtless never need. Moreover, it produces all this information in Roman, Fiscal, Manufacturing and Reporting calendars.
Grant has leveraged the Microsoft.AnalysisServices.TimeDimGenerator namespace in order to do this which means that the component is dependant on your having Analysis Services installed locally. That sounds like a limitation but that isn't really the case. The aim of the sample isn't to provide a working component but instead to educate the community as to how to "roll your own" components. To that end Grant has achieved superbly.
Some of the code in there is way too advanced for an amateur C# developer like myself to understand but the basic concepts of implementing the PipelineComponent interface are very well demonstrated. All the normal design-time methods:
are covered plus less-seen event capture methods such as:
I haven't seen many (any???) demos/samples where they are all covered so this is really useful stuff.
There's other things in there which I had never seen before:
1) Throwing ComException exceptions
2) Using Resources
3) Using regular expressions to parse property values
Personally, I would rather the component were a source component that just generated a dataset of dates between two supplied values rather than a transform but to be honest, that doesn't really matter. Its very easy to generate a set of dates (using a trusty script component) to be used as input to this CalendarTransform.
Alternatively you can easily port Grant's code into a source component of your own - he's done all the hard work for you!
This is the first sample component that I've looked at. I plan to look at the others soon - I just hope they're not all as complicated as this one!
Here's a screenshot of the Calendar Transfrom at work: