Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mondrian returns one member per Position #1058

Open
pgschr opened this issue Jun 4, 2018 · 0 comments
Open

Mondrian returns one member per Position #1058

pgschr opened this issue Jun 4, 2018 · 0 comments

Comments

@pgschr
Copy link

pgschr commented Jun 4, 2018

Given the following FoodMart MDX statement executed with OLAP4J/Mondrian, I'm expecting the column headers to return N members for each position according to the hierarchy. Instead, it returns a single member (the bottom one). In the case of [Store State], I'm expecting two members, for example 'Canada' and 'BC', instead position.getMembers only returns 'BC'.

Is there anything wrong in the way the axes are printed?

Code in Scala:

       val select = "SELECT " +
                    "[Measures].[Count] ON ROWS,  " +
                    "[Store].[Store State].Members ON COLUMNS " +
                    "FROM [HR] "
                    
       val olapConnection = pool.getConnection
       val statement = olapConnection.createStatement
       val cellSet = statement.executeOlapQuery(select)
       printCellSet(cellSet)
       pool.close(olapConnection)
     ......
     ......
    def printCellSet (cellSet: CellSet) = {
      
       val cellSetAxes = cellSet.getAxes.asScala
       val columnsAxis = cellSetAxes(Axis.COLUMNS.axisOrdinal)
       for ( colPosition <- columnsAxis.getPositions.asScala) yield {
            val members = colPosition.getMembers.asScala
            println(members)
       }
       
       var cellOrdinal = 0
       val rowsAxis = cellSetAxes(Axis.ROWS.axisOrdinal)
       for ( rowPosition <- rowsAxis.getPositions.asScala) yield {
            val members = rowPosition.getMembers.asScala
            println(members)
            
            // for each row, loop through every column to get the cell value
            for ( colPosition <- columnsAxis.getPositions.asScala) yield {
              
              val cell = cellSet.getCell(cellOrdinal)
              cellOrdinal = cellOrdinal + 1
              println(cell.getFormattedValue)
              
            }
        }
     }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant