Sei sulla pagina 1di 8

The Quandary

Ive literally written a ton of VBA code over the years to enhance my end users experience. For example, Ive often slapped a button on a worksheet or toolbar and used the E_PICK to pop-up a dimension subset editor allowing a selection of particular element and then using that selection to drive changes in the worksheet. This works well:

E_PICK
Cognos TM1 gives us the E_PICK function which is a macro function, valid only in Microsoft Excel macros and VBA modules. The function calls the TM1 Subset Editor, listing all elements in the specified dimension. The element name you select in the Subset Editor becomes the return value of the E_PICK function call. Syntax E_PICK(Dimension, Alias, Subset, Element); But! What I really want to do from time to time is allow selection and return of multiple elements -which E_PICK does not support. For example, I have a worksheet that lists accounts down the left of the worksheet and periods across the top. My goal is to allow the user to select from the periods dimension a period view. This can be any combination of periods. A typical view selection might include a total year, 4 quarters and 3 months:

I want to permit the user to select all 8 elements and have them returned preferably in an array. No such luck with the E_PICK!

A Workable Solution
But, if I change out the E_PICK function with the SUBPICK, Im (kind of) in business. Have a look at the SUBPICK: SUBPICK This is also a macro function, valid only in Microsoft Excel macros and VBA modules. This function calls a dialog box that lists all the elements in the specified subset. The elements you select are inserted in the active worksheet, starting at the current cell position. Syntax SUBPICK(dimension, subset, vertical)

Sweet! So I set up that same button, use the SUBPICK, and up comes that same subset editor, exposing the period dimension and this time my user makes the multiple selection and clicks OK. Now, Cognos TM1 doesnt understand arrays yet, so it does the next best thing. It returns the selected elements into your Microsoft Excel worksheet which is nothing more than an array of cells. You can even designate which worksheet (you make that worksheet the active sheet) and which cells (vertical a column or horizontal a row). So, in my case I spun the following simple, but useful, VBA code: gotta make sure that its the active sheet and pointing to A1 Worksheets(sInputWorksheetName).Activate Worksheets(sInputWorksheetName).Range(A1).Select

call tm1 subpicker and then set the screen updating off so we can rebuild the template w/o showing the user the dirty work it also saves on performance sPeriodSelections = Application.Run(SUBPICK, sPeriodDimName, default, True) Application.Cursor = xlWait Application.ScreenUpdating = False Application.StatusBar = Configuring Template Periods. Please Wait! Then of course Id write some clever lines of code to refresh the periods currently residing across the top of my worksheet with the newly selected ones making sure to then recalculate my sheet to bring back my TM1 data.

A Little Bit More


Of course I soon found that my users only had a handful of period views that they really cared about 90% of time and now they were annoyed that they had to reselect the same periods each time they used my worksheet. So

SUBDEFINE
This function creates a dimension subset consisting of element names found in the active worksheet. So, making use of this handy little nugget, I implemented a few more lines of code to allow the user to save their favorite period views on the TM1 server for later selection and use. lAns = MsgBox(Save Your Period View To TM1?, vbYesNo, Save Period View) If lAns = vbYes Then Worksheets(sInputWorksheetName).Unprotect myname = InputBox(Please Enter A Name To Save Your Period View As!, Save) bResult = Application.Run(SUBDEFINE, sPeriodDimName, Trim(myname), Worksheets(sInputWorksheetName).Range(A1:A999)) If bResult = True Then MsgBox Period View Saved to TM1! End If I know I know, so I finally ended up getting really creative and allowed the user to:

Share their views (save them as a public subset rather than a private subset) Define a default period view that would load up upon opening the worksheet Of course check for the existence of a previously saved view of the same name and choose to overwrite or provide an different name

And so on you get the picture

On a side note: Ive reached my goal (although a bit later than Id planned) of logging 1000+ miles this year. Here is a pic from last nights 7 miler:

Reality is merely an illusion, albeit a very persistent one. Albert Einstein Thanks!

Tags: application, Certification, cognos, Excel, E_PICK, GUI, Microsoft, private subset, rules, SUBDEFINE, SUBPICK, subset, subset editor, TM1, TM1 functions, TM1 training, VBA Posted in News | No Comments

Navigating Cognos TM1 Cube Types

by Jim Miller on October 19th, 2011


1 inShare

navigation Cubes are to TM1 what tables are to relational databases. Almost all data stored in TM1 is stored in and accessed from cubes. Do you know the difference between the types of these basic objects?

Lets explore!

First, each and every TM1 cube must have at least two and up to a maximum of 256 dimensions. There are four types of cubes in Cognos TM1. They are:

Standard, Control, Virtual and Lookup.

Standard Cubes

A standard Cognos TM1 cube is referred to as a hard cube or a cube where data is actually loaded and resides. There are two ways to create (standard) cubes:

Empty Cube You can manually create an empty cube by selecting (at least) 2 dimensions from the list of existing dimensions in the Creating Cube window to create a new cube with no data. External Data Sources You can create a cube and load it with data by using TurboIntegrator to identify and map dimensions and data from an external data source to a new or existing cube. (Of course, this requires some expertise using TurboIntegrator).

Control Cubes
Control cubes are special Cognos TM1 cubes. These special cubes are created and used by TM1 and by definition, are hard cubes that hold data. Cognos TM1 itself uses control cubes to perform certain activities (of course you can access information in these cubes as well). These activities are:

Security Client and Group Administration Object Attribute and Properties Control Performance Monitoring Hold Tracking by username

All control cube names are prefixed with a first character of } and are by default not visible within in TM1 Server Explorer. These cubes can be made visible in TM1 Server Explorer by: 1. Selecting View and then 2. Display Control Objects. Note: It is possible to create a cube and prefix its name with the } but although this will show and hide your cube with the rest of the } cubes your cube will not really be a TM1 control cube.

Virtual Cubes
A virtual cube is a TM1 cube which is referred to as a soft cube where no data actually is loaded to or resides in but references data points in other cubes.

To a TM1 user, a virtual cube may have the exact same appearance of a standard or hard cube. Being a fully rule calculated cube, virtual cubes have no data stored in them but use rules to pull data from other cubes (and possibly to perform additional calculations on that data). To perform this data pull into your virtual cube, you utilize TM1 inter-cube rules. These rules must be associated with that virtual cube. While the rule statements reside in the target cube, the feeder statements to support these rules will always reside in the source cube. Youll use the TM1 rule DB function. The DB function must reference the cube (where the data you want to retrieve lives) and then provide a value for each of the dimensions in that cube:
DB('myCube', dimension value, dimension value,... dimension value); Of course, you can only reference or pull data from cubes that reside in the same TM1 instance as the virtual cube.

Some Cognos TM1 cubes may be very complicated, large or have intensive rule calculations. In other examples, data required for a reporting may be sourced from multiple cubes. In these cases, specific end user reporting may become difficult (especially for the more casual TM1 user) or somewhat slow. Defining several specific virtual cubes referencing information in unique views of the larger cube or cubes can be very useful.

Lookup Cubes
Another type of TM1 cube is the Lookup cube. This is a sort of utility cube. Lookup cubes are cubes that you can set up and use to support other cubes and processes within a TM1 application. These cubes are usually read-only or even made not visible to the user and may contain calculations or reference data that is then pulled into other cubes using TM1 rules. Whenever there is a need to perform a translation or conversion of information, your choices would be to use an element attribute or a Lookup cube. Typically, if its a single point translation (involves only one dimension) youd want to use an attribute. If the translation involves multiple points, then you would use a lookup cube. Okay thats the 4 types did I miss any?

Potrebbero piacerti anche