custom property value is null
Hi
I working on a project using olap4j and Mondrian. I have a dimension 'Region', with 3 levels and 2 properties on the first level. Mondrian schema snipped below:
<level name="Country" column="country_code" type="String" uniquemembers="false">
<property name="CountryName" column="country_name" type="String">
<property name="Country ISO" column="country_iso" type="String">
</property></property></level>
<level name="Region Name" column="region_name" type="String" uniquemembers="false">
<level name="Dial Code" column="dial_code" type="String" uniquemembers="true"></level></level>
I wan to display the property of the Country level i.e. CountryName and Country ISO
When I use jPivot, all works. I can view Country (by code) and I can display property values.
When I try to do the same in code I always get null as the property value.
test code:
Cube cube = getCube();
Dimension dimension = cube.getDimensions().get(dimensionName);
for (Member m : dimension.getDefaultHierarchy().getDefaultMember().getChildMembers()) {
for (Property p : m.getProperties()) {
System.out.println(m.getName() + " : " + p.getName() + " : " + m.getPropertyFormattedValue(p));
}
}
Using m.getPropertyValue(p) also returns null
output:
61 : CATALOG_NAME : af
61 : SCHEMA_NAME : af
61 : CUBE_NAME : CDR
61 : DIMENSION_UNIQUE_NAME : [Region]
61 : HIERARCHY_UNIQUE_NAME : [Region]
61 : LEVEL_UNIQUE_NAME : [Region].[Country]
61 : LEVEL_NUMBER : 1
61 : MEMBER_ORDINAL : 114519
61 : MEMBER_NAME : 61
61 : MEMBER_UNIQUE_NAME : [Region].[61]
61 : MEMBER_TYPE : REGULAR
61 : MEMBER_GUID : null
61 : MEMBER_CAPTION : 61
61 : CHILDREN_CARDINALITY : 20
61 : PARENT_LEVEL : 0
61 : PARENT_UNIQUE_NAME : [Region].[All Regions]
61 : PARENT_COUNT : 1
61 : DESCRIPTION :
61 : $visible : null
61 : MEMBER_KEY : null
61 : IS_PLACEHOLDERMEMBER : null
61 : IS_DATAMEMBER : null
61 : DEPTH : 1
61 : DISPLAY_INFO : null
61 : VALUE : null
61 : CountryName : null
61 : Country ISO : null
Using Mondrian v 3.2.1.13885
olap4j olap4j-0.9.9-SNAPSHOT (had the same problem on olap4j-0.9.8.343)
Good work guys.
Thanks
Hello,
I am developing a project to access to Mondrian sources with OLAP4J and I have got the same problem.
I am working directly with the mondrian examples (release 3.2), and I have got problems with queries like:
[i]"SELECT [Measures].members ON COLUMNS,
[Store].members dimension properties [Store].[Store Name].[Store Manager] ON ROWS FROM [Sales Ragged]"
[/i]
If I execute this query from JPivot, I can see the correct values of members from [Store] hierarchy and the measures, but any about the desired dimension properties. Although, if I click on the button "Mostrar propiedades" (in my Spanish version, "Show properties in english version I suppose), then all the properties are shown (I attach a capture).
For debug, I try to get the properties of members in this way:
Well, I downloaded the olap4j source code (0.9.8 version) and I can see that the method "getPropertyValue" of the member (an XmlaOlap4jPositionMember instance) firstly tries to get the property from a map named "propertyValues". This map HAS GOT the desired property with the correct value!, but unfortunately the "containsKey" method does not match with the property parameter, because the map has got instances of XmlaOlap4jCellSetMemberProperty, and the property parameter is an instance of XmlaOlap4jProperty :-S. I do not know if this is correct, but it seems a bit strange.
Finally, the method tries to get the property from an encapsulated member (instance of XmlaOlap4jMember) which has got a properties map, but this map is empty.
I think this is the same problem that "mac-b" has got.
Is there some workaround?, or do you think to solve this issue?
Many thanks in advanced.
These changes apparently fixes the problem by connecting to 'Microsoft Analysis Services'
Index: src/org/olap4j/driver/xmla/XmlaOlap4jProperty.java
--- src/org/olap4j/driver/xmla/XmlaOlap4jProperty.java (revision 452)
+++ src/org/olap4j/driver/xmla/XmlaOlap4jProperty.java (working copy)
@@ -62,11 +62,14 @@
public ContentType getContentType() {
return contentType;
}
}
public boolean equals(Object obj) {
return (obj instanceof XmlaOlap4jProperty)
&& this.uniqueName.equals(
}
}
Index: src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java
--- src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java (revision 452)
+++ src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java (working copy)
@@ -31,6 +31,7 @@
import java.util.Map.;
import java.util.regex.;
+
/**
@@ -1534,7 +1535,47 @@
childrenCardinality, memberOrdinal, map);
list.add(member);
}
-
@@ -1547,9 +1588,9 @@
continue;
}
for (Property property : level.getProperties()) {
if (property instanceof XmlaOlap4jProperty
{
map.put(property, node.getTextContent());
}
Hello fsaz,
I have tried your suggested changes to access to a mondrian server through XMLA driver and it is not still resolved the problem.
The scenary and the results are the same I posted two months ago.
Any idea, workaround or future solution?
Thanks.
Another proof I have done with mondrian examples.
I am trying to get the [Store Manager] property, so I am executing a query like this:
SELECT [Store].[Store Name].MEMBERS DIMENSION PROPERTIES [Store].[Store Manager] ON ROWS,
[Measures].members ON COLUMNS
FROM [Store]
Well, accesing to the properties like I show in the code below (this the unique way I found to get properties from Java code), the "UNIQUENAME" for the desired property is "[Store].[Store_x0020_Manager]", instead of "[Store].[Store Manager]"
But, for me, the major problem is that if you try to get the property with this uniquename in the MDX sentence, the results have not got the property value, this is null.
SELECT [Store].[Store Name].MEMBERS DIMENSION PROPERTIES [Store].[Store_x0020_Manager] ON ROWS,
[Measures].members ON COLUMNS
FROM [Store]
I think this is a bug, If you put in your query the name [Store].[Store Manager], the returned value must have as name "[Store].[Store Manager]". Or, in the other hand, if the uniquename is [Store].[Store_x0020_Manager], you should can query for the property in the MDX with this uniquename.
Please, if i am wrong or there is a better another way to get the properties, tell me.
public class Sample {
// String query = "SELECT [Store].[Store Name].MEMBERS DIMENSION PROPERTIES [Store].[Store_x0020_Manager] ON ROWS, "
String query = "SELECT [Store].[Store Name].MEMBERS DIMENSION PROPERTIES [Store].[Store Manager] ON ROWS, "
}
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
I trace the problem for the whole afternoon and found the root cause comes from the missing "equal" method in class "XmlaOlap4jCellSetMemberProperty" which causes the mehtod "Map.containKey" fails to lookup the correct user-defined property..
Below is my fix (Beta version)
----------------------------XmlaOlap4jCellSetMemberProperty.java------------------------------
Up priority since patch is supplied.
Hi all,
There is still no solution to this issue (patches are not working). Is there any progress? Is there something we can help you with?
Cheers!
Vlado
Hi Vlad,
No solution yet. I've just read the code and it's highly likely to create bugs. The methods for hashCode and equals are both missing. Also the report above about having both XmlaProperties and XmlaOlap4jCellSetMemberProperty in the same collection is worrying.