0
votes

I have a mdx query which gives me the result as shown in the attached image. I want to read the dimensions i.e column headers and row headers in from java using olap4j libraries. Using getCell method I can read the values, can anyone tell me which methods to use to read the column header and row headers.(MDX ResultTotal Sales Amount, Sunday,monday ...)

1

1 Answers

0
votes

CellSet from olap4j (apart from cells) has axes (rows, columns, slicer). It looks like in your case,

  1. Total Sales Amount is measure selected on column axis.
  2. Sunday, Monday are members of some dimension on row axis.

You could do following to retrieve those,

CellSet cellSet = //retrieve cellset
List<CellSetAxis> axes = cellSet.getAxes(); //Gives you all axes
CellSetAxis columnAxis = axes.get(0); //Will give you column axes
CellSetAxis rowAxis = axes.get(1);
List<Position> pos = rowAxis.getPositions();
for(Position p:pos){
     List<Member> members = p.getMembers();
     Member m = members.get(0); //will give you Sunday 
}

This will give you more detail of API.