In SSAS cubes, dimension attributes can be configured as invisible. This results in them not being shown for selection in Excel (and presumably in other UI tools too).
It is perfectly valid to execute an MDX query which specifies an invisible hierarchy (e.g. on an axis).
OLAP4J currently cant handle this: An OlapException is thrown when the query result is received from the server.
The reason for this is that when OLAP4J retrieves its meta-data, it does not retrieve invisible dimension attribute hierarchies. It currently sends a Discover / MDSCHEMA_HIERARCHIES request - and by default the result of this does not include invisible hierarchies. Thus, when an invisible hierarchy is referenced in an MDX query result, Olap4J doesn't know about it - and so breaks.
Invisible hierarchies can be retrieved from a Discover / MDSCHEMA_HIERARCHIES request by providing a HIERARCHY_VISIBILITY element in the restriction list of this request.
The value of this element is a bitmap determining the hierarchies to be returned:
1 = visible only (the default)
2 = invisible only
3 = visible + invisible
My initial feeling on this is that olap4j should probably -always- retrieve invisible elements in its meta-data list (so that it is capable of dealing with valid queries).
However, some thought should probably be given to how this is exposed at the API level. The obvious approach here is to add an #isVisible method to Hierarchy. Note that the Discover / MDSCHEMA_HIERARCHIES result includes a flag indicating the visibility of each hierarchy, so if Olap4J always requests visibility <HIERARCHY_VISIBILITY>3</HIERARCHY_VISIBILITY> (i.e. visible and invisible) it will be able to mark each Hierarchy in its meta-data as visible or not as applicable.
Going this way would then enable UI toolkits sitting atop Olap4J to inspect Hierarchy#isVisible() in order to determine whether a hierarchy should be presented to end users for selection.
In all cases though, Olap4J should be capable of handling the results of MDX queries which specify invisible hierarchies on an axis (as this is always a valid thing to do), so it's internal meta-data should know about these - irrespective of what is decided at the API level.
Log in to post a comment.