[Mondrian] Cognos 8.3 & "VBA!" Functions

timothy.lambert at thomsonreuters.com timothy.lambert at thomsonreuters.com
Wed Apr 23 18:33:28 EDT 2008

Cognos 8.3 generates MDX VBA functions prefixed with "VBA!"; e.g. VBA!LEN(<string>).  The signatures and semantics of the functions are the same.

I've investigated a number of ways to enhance Mondrian to support this prefix.  

With all these following solutions, the Mondrian lexical analyzer needs to be enhanced to support an identifier token that contains a '!'.  This is trivial since the grammar does not specify the use of '!'.  Specifically, at line 640 in Scanner.java#21, add " case '!':

After this is done, one of the following can be done...

1) At the scanner level strip "VBA!" from identifiers.

2) When functions are being resolved during parser reduction action processing, strip "VBA!" from the function name being resolved.

3) Some variation of 1 or 2 in which an alias map is used instead of just handling "VBA!".
4) In the Vba class, make a new method for each VBA! alias.  Each new method would delegate to its non-VBA! counterpart.

5) Enhance FunDef and Resolver to support the notion of aliases.


While 1 and 2 are really quick to implement, I view them as hacks.  Hacks because they are disjoint from the code that sets up function definitions, and does not fit well within the OO design of the rest of the system.
I view 3 as only slightly better.  Depending on how the map is constructed it may have the same design flaw as 1 and 2.

The forth option is also easy and pretty clean.  The only problem is that it only handles the VBA! problem.  Other functions are setup differently and would require a different (albeit similar) approach.  Furthermore it's very verbose.
I would like to promote some variation of 5.  The question is how to best incorporate general alias information into the rest of the processing.

One idea that I was playing with is to create a Resolver decorator/wrapper that exposes the aliased name but delegates to the same Resolver instance setup for the "normally" named FunDef.

There would be a bit of code that processes the aliases and adds Resolver instances to the map that is part of FunTableImpl.

Once that map is setup, the rest of the code should operate as is.

Feedback appreciated.

- Tim

More information about the Mondrian mailing list