mysticfall / pivot4j

Pivot4J provides a common API for OLAP servers which can be used to build an analytical service frontend with pivot style GUI.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Correct support for non-numeric measure values

d-amelin opened this issue · comments

I'm facing a problem with string measure value. There is a calculated measure 'Units' that give string value to display units (eg "kg."):
WITH MEMBER [Measures].[Units] AS [Indicator].CurrentMember.Properties("Units") SELECT {[Measures].[Units], [Measures].[Value] }....

but I got the following error:
at org.pivot4j.ui.table.TableRenderer.getValue(TableRenderer.java:217) at org.pivot4j.ui.table.TableRenderer.renderDataRow(TableRenderer.java:727) .... Caused by: org.olap4j.OlapException: not a number at mondrian.olap4j.MondrianOlap4jConnection$Helper.createException(MondrianOlap4jConnection.java:808) at mondrian.olap4j.MondrianOlap4jCell.getDoubleValue(MondrianOlap4jCell.java:101) at org.pivot4j.ui.table.TableRenderer.getValue(TableRenderer.java:215) ....

There are same issue: Support for non-numeric measure values. #147 https://github.com/mysticfall/pivot4j/issues/147
fixed with commit: https://github.com/mysticfall/pivot4j/commit/0920002af73f4f67986f8a1a248257a885f76059

but that fix is not enought for me:

i think we need threat OlapException raised by Cell.getDoubleValue in same way as NumberFormatException, ie ignore it.

That sounds reasonable to me. I just reviewed your PR and merged with the master. I'll start the publishing process as soon as possible.

Thanks much for the contribution!