· Nov 17, 2016 2m read

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.

 quit pKey


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!

Discussion (7)2
Log in or sign up to continue

Some interesting things to note:

If you DO NOT put your custom class in the %DeepSee.Time package, it will not be visible through the Architect UI. Even if you do not include it in the %DeepSee.Time package, you will be able to modify your cube definition from Studio and specify your custom class. For example, I created the following class:


      Class User.CustomTime1 Extends %DeepSee.Time.AbstractLevel


This custom class IS NOT visible in the Architect's "Extract value with function" drop down. However, I created a level with the following timeFunction value in my cube class from Studio:




Manually entering this value will work and your custom time functions will be able to survive upgrades. If you do include your class in %DeepSee.Time, it will be listed in the Architect UI