[Mondrian] Cognos 8.3 & "VBA!" Functions

Julian Hyde jhyde at pentaho.com
Wed Apr 23 20:07:41 EDT 2008


For tracking purposes, can you please log a bug for this.

How general does MDX syntax allow package names to be? Does it allow
multiple levels of qualification (e.g. 'Foo!Bar!MyFun()')? Does it allow
spaces (e.g. 'VBA ! Len("foo")).

We should change the scanner to handle the most general case. I think that
will mean that a function is a list of names rather than the current single
name. Then FunTable.getDef() will become

    public FunDef getDef(
        Exp[] args,
        Validator validator,
        List<String> funNames,
        Syntax syntax)

Initially we can change getDef to ignore all but the last member of the name
list, that is, assume that functions are globally unique.

Julian

 

> -----Original Message-----
> From: mondrian-bounces at pentaho.org 
> [mailto:mondrian-bounces at pentaho.org] On Behalf Of 
> timothy.lambert at thomsonreuters.com
> Sent: Wednesday, April 23, 2008 3:33 PM
> To: mondrian at pentaho.org
> Subject: [Mondrian] Cognos 8.3 & "VBA!" Functions
> 
> 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
> 
> 
> 
> 
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian
> 





More information about the Mondrian mailing list