Skip to content

Commit

Permalink
MONDRIAN: Fix slicer members in XML/A output - previously, was return…
Browse files Browse the repository at this point in the history
…ing the default member of each hierarchy, regardless.

[git-p4: depot-paths = "//open/mondrian/": change = 8207]
  • Loading branch information
julianhyde committed Nov 22, 2006
1 parent 9c23274 commit 703f323
Show file tree
Hide file tree
Showing 4 changed files with 579 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/mondrian/xmla/XmlaHandler.java
Expand Up @@ -1247,9 +1247,22 @@ private void axes(SaxWriter writer) {
writer.startElement("Tuple");

final QueryAxis slicerAxis = result.getQuery().getSlicerAxis();
final Member[] slicerMembers =
result.getSlicerAxis().positions[0].getMembers();
for (int i = 0; i < hierarchies.length; i++) {
Hierarchy hierarchy = hierarchies[i];

// Find which member is on the slicer. If it's not explicitly
// there, use the default member.
Member member = hierarchy.getDefaultMember();
for (int j = 0; j < slicerMembers.length; j++) {
Member slicerMember = slicerMembers[j];
if (slicerMember.getHierarchy().equals(hierarchy)) {
member = slicerMember;
break;
}
}

if (member != null) {
slicerAxis(writer, member, getProps(slicerAxis));
} else {
Expand Down
13 changes: 13 additions & 0 deletions testsrc/main/mondrian/xmla/XmlaBasicTest.java
Expand Up @@ -429,6 +429,19 @@ public void testDrillThrough() throws Exception {
props.setProperty(DATA_SOURCE_INFO_PROP, DATA_SOURCE_INFO);
doTest(requestType, reqFileName, "${response}", props);

}

public void testExecuteSlicer() throws Exception {
String requestType = "EXECUTE";
String reqFileName = "EXECUTE_Slicer_in.xml";
Properties props = new Properties();
props.setProperty(REQUEST_TYPE_PROP, requestType);
props.setProperty(CATALOG_PROP, CATALOG);
props.setProperty(CATALOG_NAME_PROP, CATALOG);
props.setProperty(CUBE_NAME_PROP, SALES_CUBE);
props.setProperty(FORMAT_PROP, FORMAT_MULTI_DIMENSIONAL);
props.setProperty(DATA_SOURCE_INFO_PROP, DATA_SOURCE_INFO);
doTest(requestType, reqFileName, "${response}", props);
}

/*
Expand Down

0 comments on commit 703f323

Please sign in to comment.