[Mondrian] Parent-child hierarchies and StrToMember
Julian Hyde
jhyde at pentaho.org
Sun Feb 17 13:59:52 EST 2008
Nikolay,
Can you please log a bug with all of this information in it. I will get to
it as soon as I can. If you can reproduce the problem against the FoodMart
database, even better - we will be able to fix it faster.
Julian
> -----Original Message-----
> From: mondrian-bounces at pentaho.org
> [mailto:mondrian-bounces at pentaho.org] On Behalf Of Nikolay Samofatov
> Sent: Sunday, February 17, 2008 3:32 AM
> To: Mondrian developer mailing list
> Subject: [Mondrian] Parent-child hierarchies and StrToMember
>
> Hi, Dear Mondrian developers!
>
> We have encountered an issue with parent-child hierarchies.
>
> The problem is that if you take UniqueName for a member in a
> parent-child hierarchy and than pass it to a StrToMember it
> cannot find
> a member.
>
> The UniqueName is generated in the form:
> <HierarchyName>.<AllMemeberName>.<ParentName>.<ChildName>......
>
> Such name does not resolve in recent mondrian (tested
> perforce version
> as of yesterday).
>
> This logic doesn't work for a while already. I think this is a
> regression from Mondrian 2.2 release, but I didn't test to find exact
> build where it got broken.
>
> To reference members in parent-child hierarchy now one has to use:
> <HierarchyName>.<LevelName>.<MemberName>
>
> If so, shouldn't UniqueName return names in this form for
> members of a
> parent-child hierarchy?
>
> As an example, see cube:
>
> <Cube name="Фильтры и представления">
> <Table name="KBK_REGION_FACT"/>
>
> <Dimension name="Территория" foreignKey="REGION">
> <Hierarchy hasAll="true" parentColumn="PARENT_ID"
> allMemberName="Все территории" primaryKey="ID">
> <Table name="TERRITORY"/>
> <Level name="Территория" column="ID" nameColumn="CAPTION"
> parentColumn="PARENT_ID" uniqueMembers="true">
> <Property name="HasChildren" type="Numeric"
> column="HAS_CHILDREN"/>
> <Closure parentColumn="PARENT_ID"
> childColumn="TERRITORY_ID">
> <Table name="TERRITORY_CLOSURE"/>
> </Closure>
> </Level>
> </Hierarchy>
> </Dimension>
>
> <Dimension name="КБК" foreignKey="KBK">
> <Hierarchy hasAll="true" allMemberName="Все коды"
> primaryKey="KBK">
> <Table name="KBK_VIEW"/>
> <Level name="КБК1" column="KBK1" uniqueMembers="true"/>
> <Level name="КБК2" column="KBK2" uniqueMembers="true"/>
> <Level name="КБК" column="KBK" uniqueMembers="true"/>
> </Hierarchy>
> </Dimension>
>
> <Measure name="PARAM" column="AMOUNT" aggregator="sum"
> formatString="#,###.00"/>
>
> </Cube>
>
> The query:
>
> with member [Measures].[Test] as
> 'StrToMember([Территория].CurrentMember.UniqueName)'
> select NON EMPTY {[Measures].[Test]}
> ON COLUMNS,
> crossjoin({[Территория].[Территория].[Венгрия]},
> {[КБК].AllMembers})
> ON ROWS
> from [Фильтры и представления]
>
> Dies with:
>
> Caused by: mondrian.olap.MondrianException: Mondrian Error:MDX object
> 'Венгрия' not found in member '[Территория].[Все территории]'
> at
> mondrian.resource.MondrianResource$_Def1.ex(MondrianResource.java:802)
> at mondrian.olap.Util.lookupCompound(Util.java:585)
> at
> mondrian.rolap.RolapSchemaReader.lookupCompound(RolapSchemaRea
> der.java:345)
> at
> mondrian.olap.DelegatingSchemaReader.lookupCompound(Delegating
> SchemaReader.java:100)
> at
> mondrian.olap.Query$QuerySchemaReader.lookupCompound(Query.java:1539)
> at
> mondrian.olap.Query$QuerySchemaReader.lookupCompound(Query.java:1506)
> at
> mondrian.olap.fun.BuiltinFunTable$23.strToMember(BuiltinFunTab
> le.java:649)
> at
> mondrian.olap.fun.BuiltinFunTable$23$1.evaluateMember(BuiltinF
> unTable.java:639)
> at
> mondrian.calc.impl.MemberValueCalc.evaluate(MemberValueCalc.java:47)
> at
> mondrian.rolap.RolapEvaluator.evaluateCurrent(RolapEvaluator.java:529)
>
>
>
> Nikolay Samofatov
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian
>
More information about the Mondrian
mailing list