2
votes

I have created a dimension with parent-child hierarchy as follows -

<Dimension type="StandardDimension" visible="true" foreignKey="ContextID" 
       highCardinality="false" name="Learning Context">
  <Hierarchy name="Learning Context Level" allMemberName="All Contexts" 
       hasAll="true" primaryKey="ID">
    <Table name="LearningContext">
    </Table>
    <Level name="ID" visible="true" column="ID" type="Numeric" 
       uniqueMembers="true" levelType="Regular" hideMemberIf="Never" 
       parentColumn="ParentID">
    </Level>
  </Hierarchy>
</Dimension>

The problem is, when i want to get the children of a child, then i have to put it's parents as well in the mdx query.

For example -: I have a row with id 5, whose children i want to see. Now my mdx query is..

select
    Descendants([Learning Context.Learning Context Level].&[5],
             [Learning Context.Learning Context Level].[ID], SELF_AND_AFTER) on 0
from
    StudentActivity

which says :

Mondrian Error:MDX object '[Learning Context.Learning Context Level].&[5]' not 
found in cube 'StudentActivity'

But when i execute following query... it works fine.

select
    Descendants([Learning Context.Learning Context Level].&[1].&[2].&[3].&[5], 
             [Learning Context.Learning Context Level].[ID], SELF_AND_AFTER) on 0
from
    StudentActivity

I do not want to use all the parents of a child to get its children.

Please help me out.

1

1 Answers

0
votes

If you use a parent-child hierarchie, you have to prepare and use a closure-table