[Mondrian] MondrianEvaluationException when calling CurrentMember.Name over a calculated member

Julian Hyde jhyde at pentaho.com
Mon Oct 22 18:13:43 EDT 2012


Luc is correct -- we do support arbitrary properties over calc members. Calc members belong to a level, and they can only have properties that are valid for that level. We do not prevent other properties from being defined, but I don't know whether they are accessible.

Contributions of some extra test cases for TestCalculatedMembers would be most welcome. As close to vanilla FoodMart as you can manage.

Julian


On Oct 22, 2012, at 9:51 AM, Luc Boudreau <lucboudreau at gmail.com<mailto:lucboudreau at gmail.com>> wrote:

AFAIK, we do not support arbitrary properties over calculated members. That being said, .Name and .Properties should return the correct name and an empty property collection (or at least the name property I guess). There are other properties which should probably be supported as well, like the ordering. Please create a jira case to track this and add the full stack trace that you have obtained.

Thanks

Luc

On Tue, Sep 25, 2012 at 10:29 AM, mehdi b <mehdi_xinu at yahoo.com<mailto:mehdi_xinu at yahoo.com>> wrote:
Hi

I have a cube with calculated member called UsedCreditAvg which is defined in Measures dimenstion in the mondrian schema xml file as following

    <Cube name="CardCredit" cache="false" enabled="true" defaultMeasure="UsedCredit">
        <Table schema="BIDWH" name="SWT_CB_CRCARD_CREDIT"/>

        <DimensionUsage name="Branch" source="Branch" foreignKey="FD_BRANCH" />
        <DimensionUsage name="Date" source="Date" foreignKey="FD_DATE" />

        <Measure name="DistinctDate" column="FD_DATE" aggregator="distinct-count">
             <CalculatedMemberProperty name="applyEndMarker" value="false"/>
        </Measure>

        <Measure name="UsedCredit" column="MR_USD_CREDIT" aggregator="sum" >
             <CalculatedMemberProperty name="applyEndMarker" value="true"/>
        </Measure>

        <CalculatedMember name="UsedCreditAvg" dimension="Measures">
            <Formula>[Measures].[UsedCredit]/[Measures].[DistinctDate]</Formula>
             <CalculatedMemberProperty name="applyEndMarker" value="false"/>
        </CalculatedMember>
    </Cube>

At first, I execute the following MDX:

with
member [Date].[NewAll] as 'iif([Measures].CurrentMember.Properties("applyEndMarker")="false", [Date].[All], [Date].LastChild.LastChild)'
select NON EMPTY {{[Date].[Month].Members}, [Date].[NewAll]} ON COLUMNS,
  {[Measures].[UsedCredit], [Measures].[UsedCreditAvg]} ON ROWS
from [CardCredit]

and I got wrong result for [Measures].[UsedCreditAvg]. Then I tried some other MDX queries, and I finally found that when I execute the following MDX:

with
member [Date].[Testtt] as '[Measures].CurrentMember.Name'
select [Date].[Testtt] on axis(0),
{[Measures].[UsedCredit], [Measures].[UsedCreditAvg]} ON axis(1)
from [CardCredit]

for [Measures].[UsedCredit], I got "UsedCredit" value, but for [Measures].[UsedCreditAvg] I got "mondrian.olap.fun.MondrianEvaluationException: Expected value of type NUMERIC; got value 'UsedCredit' (STRING)".

It seems that the CurrentMemeber.Name or CurrentMemeber.Properties() dose not work over calculated members.

So is there any solution? Is it a bug? what can I do to solve the problem?



_______________________________________________
Mondrian mailing list
Mondrian at pentaho.org<mailto:Mondrian at pentaho.org>
http://lists.pentaho.org/mailman/listinfo/mondrian


_______________________________________________
Mondrian mailing list
Mondrian at pentaho.org<mailto:Mondrian at pentaho.org>
http://lists.pentaho.org/mailman/listinfo/mondrian

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20121022/2c6d897d/attachment-0001.html 


More information about the Mondrian mailing list