RGowda
RGowda

Reputation: 1

How to read column header and row header in mdx using olap4j

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 ...)

Upvotes: 0

Views: 316

Answers (1)

GauravJ
GauravJ

Reputation: 2262

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.

Upvotes: 0

Related Questions