PDA

View Full Version : Time hierarchy based on single time column



shakov
11-05-2003, 02:48 AM
Hi,
In my value table i have a Date-Column (i.e., number(8), yyyyMMdd). I need to represent it as hierarchy, for example: YEAR.QUATER.MONTH.DAY. I want to avoid usage of views. Can writing a custom MemberReader solve this problem? If yes, then what a the steps to implement it?
Thanks in advance.
Alexey

ewiltshi
11-18-2003, 09:03 AM
You could use an SQL expression to seperate the date however you want. There's an example in FoodMart.xml, but it should go something like (for MS SQL Server):
<pre>
<level ...>
<KeyExpression>
<SQL dialect="generic">
DATEPART( YEAR, dateField )
</SQL>
</KeyExpression>
</level>
</pre>

ewiltshi
11-18-2003, 09:04 AM
oops. ignore <pre> </pre> tags. My bad. :)

ewiltshi
11-19-2003, 06:41 AM
Actually... this doesn't work. I get a NullPointerException (see previous post in Help for stacktrace) - it seems like Mondrian is trying to do a join, but there's nothing to join on!
Anyone have any hints for this?

thammoud
12-07-2003, 08:56 AM
I am getting the same NPE. Did you solve this problem ? The foodmart.xml has this and I assume that it works.

thammoud
12-08-2003, 02:01 AM
Exception details:
java.lang.NullPointerException
at mondrian.olap.MondrianDef$Table.find(MondrianDef.java:1493)
at mondrian.rolap.HierarchyUsage.setJoinTable(HierarchyUsage.java:115)
at mondrian.rolap.HierarchyUsage.init(HierarchyUsage.java:93)
at mondrian.rolap.RolapHierarchy.init(RolapHierarchy.java:142)
at mondrian.rolap.RolapDimension.init(RolapDimension.java:119)
at mondrian.rolap.RolapCube.init(RolapCube.java:174)
at mondrian.rolap.RolapCube.<init>(RolapCube.java:76)
at mondrian.rolap.RolapSchema.load(RolapSchema.java:115)
at mondrian.rolap.RolapSchema.<init>(RolapSchema.java:93)
at mondrian.rolap.RolapSchema.<init>(RolapSchema.java:34)

thammoud
12-08-2003, 02:05 AM
Schema Details:
<Dimension name="Time">
<Hierarchy hasAll="true" allMemberName="All Time">
<Table name="PositionTable"/>
<Level name="Year" type="Numeric" uniqueMembers="true">
<KeyExpression>
<SQL dialect="mysql">
IF(pnlDate = '1970-01-01' , YEAR(SYSDATE()), YEAR(pnlDate))
</SQL>
<SQL dialect="generic">
IF(pnlDate = '1970-01-01' , YEAR(SYSDATE()), YEAR(pnlDate))
</SQL>
</KeyExpression>
</Level>
</Hierarchy>
</Dimension>

kable
02-19-2010, 06:11 PM
i have the same problem !!!

this have work ?