Perficient Enterprise Information Solutions Blog

Blog Categories

Subscribe via Email

Subscribe to RSS feed

Posts Tagged ‘application’

Cognos TM1 User Experience

The Quandary

I’ve literally written a ton of VBA code over the years to “enhance” my end user’s experience. For example, I’ve 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, I’m (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 doesn’t 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 it’s 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 I’d 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: I’ve reached my goal (although a bit later than I’d planned) of logging 1000+ miles this year.

Here is a pic from last night’s 7 miler:

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

Thanks!