private static void outputFlattenedRecurse( Result result, List<List<Object>> rows, List<Object> rowValues, int[] coords, int axisOrdinal ) { final Axis[] axes = result.getAxes(); if ( axisOrdinal == axes.length ) { final Cell cell = result.getCell( coords ); // Output the raw (unformatted) value of the cell. // NOTE: We could output other properties of the cell here, such as its // formatted value, too. rowValues.add( cell.getValue() ); // Add a copy of the completed row to the list of rows. rows.add( new ArrayList<>( rowValues ) ); } else { final Axis axis = axes[axisOrdinal]; int k = -1; int saveLength = rowValues.size(); for ( Position position : axis.getPositions() ) { coords[axisOrdinal] = ++k; for ( Member member : position ) { rowValues.add( member.getUniqueName() ); } outputFlattenedRecurse( result, rows, rowValues, coords, axisOrdinal + 1 ); while ( rowValues.size() > saveLength ) { rowValues.remove( rowValues.size() - 1 ); } } } }
final Cell cell = result.getCell( coords ); rowValues.add( cell.getValue() );
public synchronized Cell getCell(int[] externalPos) { try { System.arraycopy( externalPos, 0, this.pos, 0, externalPos.length); int offset = externalPos[axis]; int mappedOffset = mapOffsetToUnderlying(offset); this.pos[axis] = mappedOffset; return underlying.getCell(this.pos); } catch (NullPointerException npe) { return underlying.getCell(externalPos); } }
private void buildRows0Dim(Element parent) { int[] cellIndex = new int[0]; Element row = elem("row", parent); Cell cell = result.getCell(cellIndex); buildCell(cell, row, false); }
private void buildCells(Element row, int[] cellIndex, boolean even) { int columns = result.getAxes()[0].getPositions().size(); for (int i = 0; i < columns; i++) { cellIndex[0] = i; Cell cell = result.getCell(cellIndex); buildCell(cell, row, even); } }
private Cell getCellInternal(int[] pos) { RolapCell cell; try { cell = (RolapCell) result.getCell(pos); } catch (MondrianException e) { if (e.getMessage().indexOf("coordinates out of range") >= 0) { int[] dimensions = new int[getAxes().size()]; for (int i = 0; i < axisList.size(); i++) { dimensions[i] = axisList.get(i).getPositions().size(); } throw new IndexOutOfBoundsException( "Cell coordinates (" + getCoordsAsString(pos) + ") fall outside CellSet bounds (" + getCoordsAsString(dimensions) + ")"); } else if (e.getMessage().indexOf( "coordinates should have dimension") >= 0) { throw new IllegalArgumentException( "Cell coordinates should have dimension " + axisList.size()); } else { throw e; } } return new MondrianOlap4jCell(pos, this, cell); }
result.getCell(new int[]{0}).getFormattedValue(); mdxResult = resultString; clearError();
private boolean isEmptyRecurse(int fixedAxis, int axis) { if (axis < 0) { RolapCell cell = (RolapCell) underlying.getCell(pos); return cell.isNull(); } else if (axis == fixedAxis) { return isEmptyRecurse(fixedAxis, axis - 1); } else { List<Position> positions = getAxes()[axis].getPositions(); final int positionCount = positions.size(); for (int i = 0; i < positionCount; i++) { pos[axis] = i; if (!isEmptyRecurse(fixedAxis, axis - 1)) { return false; } } return true; } }
final Query query = connection.parseQuery(mdx); final Result result = connection.execute(query); final Object o = result.getCell(new int[0]).getValue(); return o instanceof Number ? ((Number) o).doubleValue()
public JROlapCell getCell(int[] axisPositions) { Cell dataCell = result.getCell(axisPositions); JRMondrianCell cell = new JRMondrianCell(dataCell); return cell; }