[Mondrian] <Query> element inside <Hierarchy> not working
-mondrian version 3.0.3.11016
Julian Hyde
jhyde at pentaho.com
Mon May 19 21:29:30 EDT 2008
I don't think it's anything to do with the <Query> element. It's the fact
that you are writing [Dimension].[Level].[Member], and this doesn't work
because member names may not be unique within a level. Think of
[Customer].[City].[Portland], for example. It's ambiguous whether you mean
Portland, Oregon or Portland, Maine, so the member is correctly writtem
[Customer].[USA].[OR].[Portland].
In your case, something like [DimUsers].[user456].[group5] should work,
provided user456 is a member of group5.
Julian
_____
From: mondrian-bounces at pentaho.org [mailto:mondrian-bounces at pentaho.org] On
Behalf Of Agustin Campos
Sent: Monday, May 19, 2008 7:45 AM
To: Mondrian developer mailing list
Subject: Re: [Mondrian] <Query> element inside <Hierarchy> not working
-mondrian version 3.0.3.11016
I am not very sure but I think the problem is that you are asking a third
dimension instead the two ones you have defined.
People around here will tell us if I am wrong or not.
2008/5/19 Radha Ranjan Madhaw <RMadhaw at facetime.com>:
Hi,
I've the following Dimension definition:
<Dimension name="DimUsers">
<Hierarchy hasAll="true" primaryKey="id">
<Query>
<SQL dialect="generic">
select "ug"."id" as "id", "ug"."userid" "userid", "u"."fullname" "fullname",
"ug"."groupid" "groupid", "g"."groupname" "groupname"
from "user_group" as "ug", "users" as "u", "groups" as "g"
where "ug"."userid" = "u"."userid"
and "ug"."groupid" = "g"."groupid"
</SQL>
</Query>
<Level name="User Name" column="fullname"
type="String" uniqueMembers="false"/>
<Level name="Group Name" column="groupname"
type="String" uniqueMembers="false"/>
</Hierarchy>
</Dimension>
and using it in cube MondrianTest as following
<DimensionUsage name="DimUsers" source="DimUsers"
foreignKey="user_groupid"/>
user_groupid is the foreign key present in the fact table 'fact_url_hits' of
cube MondrianTest.
When I execute the MDX query:
SELECT {[Measures].[URL Hits]} ON COLUMNS, NON EMPTY
{[Time].[2008].Children} ON ROWS FROM [MondrianTest] WHERE [DimUsers].[Group
Name].[group5]
I get the following exception:
Caused by: mondrian.olap.MondrianException: Mondrian Error:MDX object
'[DimUsers].[Group Name].[group5]' not found in cube 'MondrianTest'
at
mondrian.resource.MondrianResource$_Def1.ex(MondrianResource.java:807)
at mondrian.olap.Util.lookup(Util.java:766)
at mondrian.olap.Id.accept(Id.java:105)
at mondrian.olap.Query$StackValidator.validate(Query.java:1245)
at mondrian.olap.QueryAxis.validate(QueryAxis.java:269)
at mondrian.olap.Query.resolve(Query.java:567)
at mondrian.olap.Query.resolve(Query.java:413)
at mondrian.olap.Query.<init>(Query.java:217)
at mondrian.olap.Query.<init>(Query.java:177)
at mondrian.olap.Parser.makeQuery(Parser.java:860)
at
mondrian.olap.CUP$Parser$actions.CUP$Parser$do_action(Parser.java:1693)
at mondrian.olap.Parser.do_action(Parser.java:694)
at java_cup.runtime.lr_parser.parse(lr_parser.java:569)
at mondrian.olap.Parser.parseInternal(Parser.java:764)
... 7 more
I hope that the structure and position of <Query> element are correct as
I've followed the Foodmart.xml sample.
Not able to understand why I'm getting the error that the object
[DimUsers].[Group Name].[group5] is not found in the cube.
Any help will be appreciated.
Thanks,
Madhav
_______________________________________________
Mondrian mailing list
Mondrian at pentaho.org
http://lists.pentaho.org/mailman/listinfo/mondrian
--
Agustín Campos Muñoz
http://www.acampos.net
Email: aguscamposENgmailPUNTOcom
acamposENiiesPUNTOes
MSN Messenger: acampozENhotmailPUNTOcom
Skype: acamposnet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20080519/bce143d5/attachment.html
More information about the Mondrian
mailing list