Customizing DeepSee time level within date hierarchy
Those of you, who work with DeepSee, might have spotted, that when working with a date hierarchy, there are several functions, allowing you to select a time function for a given level. E.g. for extracting a year from a date/time property when building date hierarchy, you simply use Year function. similarly for month number, quarter and so on. Sometimes, you may wish to see the time - namely hour numbers. For this there is a HourNumber function available with DeepSee. Unfortunately, this function converts time into 12 hours format suffixed with AM/PM to indicate day part. This is not, however, much of use in certain parts of the world. You'd rather see hour numbers in 24 hour format.
Luckilly enough, the solution is easy, despite it requires some coding.
Let me guide you through the necessary steps in the following paragraphs.
First of all, the customization consist of creating a new Caché class. The class has to inherit from a % class and as you'd rather use this new class across the whole system, you need to - as a preliminary step - enable Write access to the CACHESYS database. I am not going to discuss details of this step, for details please refer to the documentation.
Now, let's start. Open the Studio (or Atelier, whichever you prefer) and navigate to %SYS namespace. Open %DeepSee.Time.HourNumber class and create a copy (Tools -> Copy Class...). Save the new class as e.g. %DeepSee.Time.HourNumber24.
Navigate to %KeyToValue function and modify the comment its last line. Now put this new line just below the commented one.
Compile the class.
Here we go, that's all we had to do! All you need to do now is just cleanup - make sure CACHELIB database is set to ReadOnly mode and go and test your new hour number function.
Now, if you look to DeepSee architect, and navigate to a combobox with Extract value with function label, you'll see something like this:
A new time function has appeared and is ready for use.
Hope you find this short article useful and it helps you!