<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns:o = "urn:schemas-microsoft-com:office:office" xmlns:st1 =
"urn:schemas-microsoft-com:office:smarttags"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2900.2912" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=084285807-10092007>I'm a freshman to Modrian
OLAP. </SPAN></DIV>
<DIV><SPAN class=084285807-10092007>In my project I defined
a "Dimension" </SPAN></DIV>
<DIV><SPAN class=084285807-10092007></SPAN> </DIV>
<DIV><SPAN class=084285807-10092007><Dimension
name="Brand"><BR> <Hierarchy hasAll="true" primaryKey="BRND_CD"
primaryKeyTable="REF_TR_BRND"><BR> <Join
leftKey="COOPR_CD"
rightKey="COOPR_CD"><BR> <Table name="TR_BRND"
schema="REF" alias="REF_TR_BRND" /><BR> <Table
name="TR_COOPR" schema="REF" alias="REF_TR_COOPR"
/><BR> </Join><BR> <Level
name="Cooprator"
column="COOPR_CD"<BR> uniqueMembers="true"
table="REF_TR_COOPR"><BR> <KeyExpression><BR> <SQL
dialect="db2">RTRIM(REF_TR_COOPR.COOPR_CD)</SQL><BR> </KeyExpression><BR> <Property
name="Cooprator Name"<BR> column="COOPR_NAM"
type="String"
/><BR> </Level><BR> <Level
name="Brand" column="BRND_CD"<BR> uniqueMembers="true"
table="REF_TR_BRND"><BR> <Property name="Brand
Name"
column="BRND_NAM"<BR> type="String"/><BR> </Level><BR> </Hierarchy><BR> </Dimension></SPAN></DIV>
<DIV><SPAN class=084285807-10092007></SPAN> </DIV>
<DIV><SPAN class=084285807-10092007>it refers two tables so I used a "Join"
relation, then 'cause the datas in the column "COOPR_CD" have spcaces ,so I use
a KeyExpression</SPAN></DIV>
<DIV><SPAN class=084285807-10092007>then my nightmare began , when I
query my cube using MDX : </SPAN></DIV>
<DIV><SPAN class=084285807-10092007>"</SPAN></DIV>
<DIV><SPAN class=084285807-10092007>select {[Brand].Members} ON
ROWS<BR>from [Communication User Count Daily Analysis];</SPAN></DIV>
<DIV><SPAN class=084285807-10092007>"</SPAN></DIV>
<DIV><SPAN class=084285807-10092007> Mondrian show me a error tip
</SPAN></DIV>
<DIV><SPAN class=084285807-10092007>"Mondrian Error:Internal error: bad relation
type null" </SPAN></DIV>
<DIV><SPAN class=084285807-10092007></SPAN> </DIV>
<DIV><SPAN class=084285807-10092007>I debug the code ,tracing again again. To
my surprise, I found that in the source code ,the logical seems
something confusing and I just fall in the pit... Let me show you.</SPAN></DIV>
<DIV><SPAN class=084285807-10092007></SPAN> </DIV>
<DIV><SPAN class=084285807-10092007>In class RolapHierarchy , the
method addToFrom follows it's statement,then it use the
"expression.getTableAlias()", which always returns a "null" . which leads the
error </SPAN><SPAN class=084285807-10092007> "bad relation type null"
in the following method addFrom.</SPAN></DIV>
<DIV><SPAN class=084285807-10092007></SPAN> </DIV>
<DIV><SPAN class=084285807-10092007>Could you help me make the method
MondrianDef.ExpressionView.getTableAlias available ? </SPAN></DIV>
<DIV><SPAN class=084285807-10092007></SPAN> </DIV>
<DIV><SPAN class=084285807-10092007>thanks</SPAN></DIV>
<DIV><SPAN class=084285807-10092007></SPAN> </DIV>
<DIV><SPAN class=084285807-10092007>void addToFrom(SqlQuery query,
MondrianDef.Expression expression)
{<BR> if (relation == null)
{<BR> throw
Util.newError(<BR>
"cannot add hierarchy " + getUniqueName()
+<BR>
" to query: it does not have a <Table>, <View> or
<Join>");<BR>
}<BR> final boolean failIfExists =
false;<BR> MondrianDef.Relation
subRelation = relation;<BR> if
(relation instanceof MondrianDef.Join)
{<BR> if
(expression != null)
{<BR>
// Suppose relation
is<BR>
// (((A join B) join C) join
D)<BR>
// and the fact table
is<BR>
//
F<BR>
// and our expression uses C. We want to make the
expression<BR>
// F left join ((A join B) join
C).<BR>
// Search for the smallest subset of the relation
which<BR>
// uses
C.<BR>
subRelation = relationSubset(relation, expression.getTableAlias());</SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN
class=084285807-10092007>
}<BR>
}<BR> query.addFrom(subRelation, null,
failIfExists);<BR> }</SPAN></DIV>
<DIV><SPAN class=084285807-10092007></SPAN> </DIV>
<DIV><SPAN class=084285807-10092007></SPAN> </DIV>
<DIV><SPAN class=084285807-10092007></SPAN> </DIV>
<DIV><SPAN class=084285807-10092007></SPAN> </DIV>
<DIV><SPAN class=084285807-10092007>public boolean addFrom(final
MondrianDef.Relation
relation,<BR>
final String
alias,<BR>
final boolean failIfExists)<BR>
{<BR> if (relation instanceof
MondrianDef.View)
{<BR> final
MondrianDef.View view = (MondrianDef.View)
relation;<BR>
final String viewAlias = (alias ==
null)<BR>
?
view.getAlias()<BR>
: alias;<BR>
final String sqlString = view.getCodeSet().chooseQuery(dialect);</SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN
class=084285807-10092007>
return addFromQuery(sqlString, viewAlias, false);</SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=084285807-10092007> }
else if (relation instanceof MondrianDef.Table)
{<BR> final
MondrianDef.Table table = (MondrianDef.Table)
relation;<BR>
final String tableAlias = (alias ==
null)<BR>
?
table.getAlias()<BR>
: alias;</SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN
class=084285807-10092007>
return addFromTable(table.schema, table.name,
tableAlias,<BR>
table.getFilter(), failIfExists);</SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=084285807-10092007> }
else if (relation instanceof MondrianDef.Join)
{<BR> final
MondrianDef.Join join = (MondrianDef.Join)
relation;<BR>
final String leftAlias =
join.getLeftAlias();<BR>
final String rightAlias = join.getRightAlias();</SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN
class=084285807-10092007>
boolean addLeft = addFrom(join.left, leftAlias,
failIfExists);<BR>
boolean addRight = addFrom(join.right, rightAlias, failIfExists);</SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN
class=084285807-10092007>
boolean added = addLeft ||
addRight;<BR>
if (added)
{<BR>
buf.setLength(0);</SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN
class=084285807-10092007>
dialect.quoteIdentifier(leftAlias, join.leftKey,
buf);<BR>
buf.append(" =
");<BR>
dialect.quoteIdentifier(rightAlias, join.rightKey, buf);</SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN
class=084285807-10092007>
addWhere(buf.toString());<BR>
}<BR> return
added;</SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=084285807-10092007> }
else {<BR>
throw Util.newInternal("bad relation type " +
relation);<BR> }<BR>
}<BR></SPAN></DIV>
<DIV><SPAN class=084285807-10092007></SPAN><SPAN
class=084285807-10092007> </SPAN><SPAN
class=084285807-10092007> </SPAN></DIV>
<DIV> </DIV>
<DIV align=left>
<DIV align=left>
<TABLE class=MsoNormalTable
style="BACKGROUND: #f0f9f9; WIDTH: 99%; mso-cellspacing: 0cm; mso-table-lspace: 2.25pt; mso-table-rspace: 2.25pt; mso-table-anchor-vertical: paragraph; mso-table-anchor-horizontal: column; mso-table-left: left; mso-padding-alt: 0cm 0cm 0cm 0cm"
cellSpacing=0 cellPadding=0 width="99%" align=left bgColor=#f0f9f9 border=0>
<TBODY>
<TR style="HEIGHT: 15pt; mso-yfti-irow: 0" height=20>
<TD
style="PADDING-RIGHT: 0cm; PADDING-LEFT: 0cm; BACKGROUND: #009999; PADDING-BOTTOM: 0cm; PADDING-TOP: 0cm; HEIGHT: 15pt"
bgColor=#009999 height=20>
<P class=MsoNormal
style="mso-pagination: none; mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><B><FONT
face=Arial color=white><SPAN lang=EN-US
style="FONT-WEIGHT: bold; COLOR: white; FONT-FAMILY: Arial; LETTER-SPACING: 1.5pt; mso-ascii-font-family: 'Times New Roman'; mso-no-proof: yes"><FONT
face=宋体>张建中</FONT> </SPAN></FONT></B><B><FONT face=宋体
color=white><SPAN lang=EN-US
style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; COLOR: white; FONT-FAMILY: 宋体; LETTER-SPACING: 1.5pt; mso-no-proof: yes; mso-bidi-font-family: Arial; mso-hansi-font-family: Arial; mso-font-kerning: 1.0pt"><o:p></o:p></SPAN></FONT></B></P></TD></TR>
<TR style="mso-yfti-irow: 1">
<TD
style="PADDING-RIGHT: 0cm; PADDING-LEFT: 0cm; BACKGROUND: none transparent scroll repeat 0% 0%; PADDING-BOTTOM: 0cm; PADDING-TOP: 0cm">
<P class=MsoNormal
style="mso-pagination: none; mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><FONT
face=Arial color=#336666 size=1><SPAN lang=EN-US
style="FONT-SIZE: 9pt; COLOR: #336666; FONT-FAMILY: Arial; mso-no-proof: yes; mso-font-kerning: 1.0pt"><o:p> </o:p></SPAN></FONT></P></TD></TR>
<TR style="mso-yfti-irow: 2">
<TD
style="PADDING-RIGHT: 0cm; PADDING-LEFT: 0cm; BACKGROUND: none transparent scroll repeat 0% 0%; PADDING-BOTTOM: 0cm; PADDING-TOP: 0cm">
<P class=MsoNormal
style="mso-pagination: none; mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><B><FONT
face=宋体 color=#336666 size=1><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 9pt; COLOR: #336666; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-no-proof: yes; mso-hansi-font-family: 'Times New Roman'"> 广州从兴电子开发有限公司</SPAN></FONT></B><B><FONT
face=Arial color=#336666 size=1><SPAN lang=EN-US
style="FONT-WEIGHT: bold; FONT-SIZE: 9pt; COLOR: #336666; FONT-FAMILY: Arial; mso-no-proof: yes">
BI</SPAN></FONT></B><B><FONT face=宋体 color=#336666 size=1><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 9pt; COLOR: #336666; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-no-proof: yes; mso-hansi-font-family: 'Times New Roman'">研发部</SPAN></FONT></B><B><FONT
face=Arial color=#336666 size=1><SPAN lang=EN-US
style="FONT-WEIGHT: bold; FONT-SIZE: 9pt; COLOR: #336666; FONT-FAMILY: Arial; mso-no-proof: yes; mso-font-kerning: 1.0pt"><o:p></o:p></SPAN></FONT></B></P></TD></TR>
<TR style="mso-yfti-irow: 3">
<TD
style="PADDING-RIGHT: 0cm; PADDING-LEFT: 0cm; BACKGROUND: none transparent scroll repeat 0% 0%; PADDING-BOTTOM: 0cm; PADDING-TOP: 0cm">
<P class=MsoNormal
style="mso-pagination: none; mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><FONT
face=Arial color=#336666 size=1><SPAN lang=EN-US
style="FONT-SIZE: 7.5pt; COLOR: #336666; FONT-FAMILY: Arial; mso-no-proof: yes"> GuangZhou
Sunrise Electronics Development CO.,LTD<SPAN
style="mso-font-kerning: 1.0pt"><o:p></o:p></SPAN></SPAN></FONT></P></TD></TR>
<TR style="HEIGHT: 14.25pt; mso-yfti-irow: 4" height=19>
<TD
style="PADDING-RIGHT: 0cm; PADDING-LEFT: 0cm; BACKGROUND: none transparent scroll repeat 0% 0%; PADDING-BOTTOM: 0cm; PADDING-TOP: 0cm; HEIGHT: 14.25pt"
vAlign=bottom height=19>
<P class=MsoNormal
style="mso-pagination: none; mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><B><FONT
face=Verdana color=#336666 size=1><SPAN lang=EN-US
style="FONT-WEIGHT: bold; FONT-SIZE: 7.5pt; COLOR: #336666; FONT-FAMILY: Verdana; mso-no-proof: yes"> </SPAN></FONT></B><B><FONT
face=黑体 color=teal size=1><SPAN lang=EN-US
style="FONT-WEIGHT: bold; FONT-SIZE: 9pt; COLOR: teal; FONT-FAMILY: 黑体; mso-no-proof: yes"><SPAN
lang=EN-US
style="FONT-WEIGHT: bold; FONT-SIZE: 9pt; COLOR: teal; FONT-FAMILY: Wingdings">(</SPAN><B><FONT
face=Verdana color=#336666 size=1><SPAN lang=EN-US
style="FONT-WEIGHT: bold; FONT-SIZE: 7.5pt; COLOR: #336666; FONT-FAMILY: Verdana">
</SPAN></FONT></B></SPAN></FONT></B><B><FONT face=Verdana color=#336666
size=1><SPAN lang=EN-US
style="FONT-WEIGHT: bold; FONT-SIZE: 7.5pt; COLOR: #336666; FONT-FAMILY: Verdana; mso-no-proof: yes">020-8711-6417
13560042989</SPAN></FONT></B></P></TD></TR>
<TR style="mso-yfti-irow: 5">
<TD
style="PADDING-RIGHT: 0cm; PADDING-LEFT: 0cm; BACKGROUND: none transparent scroll repeat 0% 0%; PADDING-BOTTOM: 0cm; PADDING-TOP: 0cm">
<P class=MsoNormal
style="mso-pagination: none; mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><FONT
face=Arial color=#336666 size=1><SPAN lang=EN-US
style="FONT-SIZE: 9pt; COLOR: #336666; FONT-FAMILY: Arial; mso-no-proof: yes"> </SPAN></FONT><FONT
face=黑体 color=teal size=1><SPAN lang=EN-US
style="FONT-SIZE: 9pt; COLOR: teal; FONT-FAMILY: 黑体; mso-no-proof: yes"><SPAN
lang=EN-US
style="FONT-SIZE: 9pt; COLOR: teal; FONT-FAMILY: Wingdings">*</SPAN></SPAN></FONT><FONT
face=Arial color=#336666 size=1><SPAN lang=EN-US
style="FONT-SIZE: 9pt; COLOR: #336666; FONT-FAMILY: Arial; mso-no-proof: yes">
</SPAN></FONT><B><FONT face=Verdana color=#336666 size=1><SPAN lang=EN-US
style="FONT-WEIGHT: bold; FONT-SIZE: 7.5pt; COLOR: #336666; FONT-FAMILY: Verdana; mso-no-proof: yes"><A
href="mailto:zhangjianzhong@revenco.com">zhangjianzhong@revenco.com</A></SPAN></FONT></B><FONT
face=Arial color=#336666 size=1><SPAN lang=EN-US
style="FONT-SIZE: 9pt; COLOR: #336666; FONT-FAMILY: Arial; mso-no-proof: yes; mso-font-kerning: 1.0pt"><o:p></o:p></SPAN></FONT></P></TD></TR>
<TR style="mso-yfti-irow: 6">
<TD
style="PADDING-RIGHT: 0cm; PADDING-LEFT: 0cm; BACKGROUND: none transparent scroll repeat 0% 0%; PADDING-BOTTOM: 0cm; PADDING-TOP: 0cm">
<P class=MsoNormal
style="mso-pagination: none; mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><FONT
face=Arial color=#336666 size=1><SPAN lang=EN-US
style="FONT-SIZE: 9pt; COLOR: #336666; FONT-FAMILY: Arial; mso-no-proof: yes"> </SPAN></FONT><FONT
face=黑体 color=teal size=1><SPAN lang=EN-US
style="FONT-SIZE: 9pt; COLOR: teal; FONT-FAMILY: 黑体; mso-no-proof: yes"><SPAN
lang=EN-US
style="FONT-SIZE: 9pt; COLOR: teal; FONT-FAMILY: Wingdings">+</SPAN></SPAN></FONT><FONT
face=宋体 color=#336666 size=1><SPAN
style="FONT-SIZE: 9pt; COLOR: #336666; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-no-proof: yes; mso-hansi-font-family: 'Times New Roman'">广州大道南</SPAN></FONT><B><FONT
face=Verdana color=#336666 size=1><SPAN lang=EN-US
style="FONT-WEIGHT: bold; FONT-SIZE: 7.5pt; COLOR: #336666; FONT-FAMILY: Verdana; mso-no-proof: yes">368</SPAN></FONT></B><FONT
face=宋体 color=#336666 size=1><SPAN
style="FONT-SIZE: 9pt; COLOR: #336666; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-no-proof: yes; mso-hansi-font-family: 'Times New Roman'">号</SPAN></FONT><st1:chmetcnv
TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue="19"
UnitName="F" st="on"><B><FONT face=Verdana color=#336666 size=1><SPAN
lang=EN-US
style="FONT-WEIGHT: bold; FONT-SIZE: 7.5pt; COLOR: #336666; FONT-FAMILY: Verdana; mso-no-proof: yes">14F</SPAN></FONT></B></st1:chmetcnv><FONT
face=Arial color=#336666 size=1><SPAN lang=EN-US
style="FONT-SIZE: 9pt; COLOR: #336666; FONT-FAMILY: Arial; mso-no-proof: yes">
</SPAN></FONT><FONT face=黑体 color=teal size=1><SPAN lang=EN-US
style="FONT-SIZE: 9pt; COLOR: teal; FONT-FAMILY: 黑体; mso-no-proof: yes">,</SPAN></FONT><FONT
face=Arial color=#336666 size=1><SPAN lang=EN-US
style="FONT-SIZE: 9pt; COLOR: #336666; FONT-FAMILY: Arial; mso-no-proof: yes">
</SPAN></FONT><B><FONT face=Verdana color=#336666 size=1><SPAN lang=EN-US
style="FONT-WEIGHT: bold; FONT-SIZE: 7.5pt; COLOR: #336666; FONT-FAMILY: Verdana; mso-no-proof: yes">510300</SPAN></FONT></B><FONT
face=Arial color=#336666 size=1><SPAN lang=EN-US
style="FONT-SIZE: 9pt; COLOR: #336666; FONT-FAMILY: Arial; mso-no-proof: yes; mso-font-kerning: 1.0pt"><o:p></o:p></SPAN></FONT></P></TD></TR>
<TR style="mso-yfti-irow: 7">
<TD
style="PADDING-RIGHT: 0cm; PADDING-LEFT: 0cm; BACKGROUND: none transparent scroll repeat 0% 0%; PADDING-BOTTOM: 0cm; PADDING-TOP: 0cm">
<P class=MsoNormal
style="mso-pagination: none; mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><FONT
face=Arial color=#336666 size=1><SPAN lang=EN-US
style="FONT-SIZE: 9pt; COLOR: #336666; FONT-FAMILY: Arial; mso-no-proof: yes; mso-font-kerning: 1.0pt"><o:p> </o:p></SPAN></FONT></P></TD></TR>
<TR style="mso-yfti-irow: 8; mso-yfti-lastrow: yes">
<TD
style="PADDING-RIGHT: 0cm; PADDING-LEFT: 0cm; BACKGROUND: #a3dada; PADDING-BOTTOM: 0cm; PADDING-TOP: 0cm"
bgColor=#a3dada>
<P class=MsoNormal
style="mso-pagination: none; mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><FONT
face=Arial color=#336666 size=1><SPAN lang=EN-US
style="FONT-SIZE: 9pt; COLOR: #336666; FONT-FAMILY: Arial; mso-no-proof: yes; mso-font-kerning: 1.0pt"><o:p> </o:p></SPAN></FONT></P></TD></TR></TBODY></TABLE></DIV>
<P class=MsoNormal><FONT face="Times New Roman" color=navy size=2><SPAN
lang=EN-US
style="FONT-SIZE: 10.5pt; COLOR: navy; mso-no-proof: yes"> </SPAN></FONT><SPAN
lang=EN-US><o:p></o:p></SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 21pt; TEXT-ALIGN: left; mso-para-margin-left: 2.0gd"
align=left><FONT face=宋体 size=2><SPAN lang=EN-US
style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体"></SPAN></FONT> </P></DIV>
<DIV> </DIV></BODY></HTML>