final List<Integer> coordList = cell.getCoordinateList(); int x = xOffsset; if ( coordList.size() > 0 ) { if ( cell.getValue() != null ) { if ( cell.getValue() instanceof Number ) { cellInfo.setRawNumber( (Number) cell.getValue() ); String cellValue = cell.getFormattedValue(); // First try to get a final Object value = cell.getValue(); if ( value == null || value.equals( "null" ) ) { cellValue = ""; try { DecimalFormat myFormatter = new DecimalFormat( "#,###.###" ); String output = myFormatter.format( cell.getValue() ); cellValue = output; } catch ( Exception e ) {
public void write( SaxWriter writer, Cell cell, Member[] members) { if (cell.isNull()) { return; } Object value = cell.getValue(); final String dataType = (String) cell.getPropertyValue(StandardCellProperty.DATATYPE); final ValueInfo vi = new ValueInfo(dataType, value); final String valueType = vi.valueType; value = vi.value; boolean isDecimal = vi.isDecimal; String valueString = value.toString(); writer.startElement( encodedName, "xsi:type", valueType); if (isDecimal) { valueString = XmlaUtil.normalizeNumericString(valueString); } writer.characters(valueString); writer.endElement(); } }
if (cell.isNull() && ordinal != 0) { for (int i = 0; i < cellProps.size(); i++) { Property cellPropLong = cellPropLongs.get(i); Object value = cell.getPropertyValue(cellPropLong); if (value == null) { continue; if (cell.isNull()) { (String) cell.getPropertyValue( StandardCellProperty.DATATYPE); final ValueInfo vi = new ValueInfo(dataType, value);
if (cell != null && !cell.isEmpty()) { try { value = cell.getDoubleValue(); } catch (OlapException e) { nonNumericValue = true; logger.trace("Non-numeric cell value : {}", cell.getValue());
private void emitCell(SaxWriter writer, Cell cell) throws OlapException { ++cellOrdinal; Util.discard(cellOrdinal); // Ignore empty cells. final Object cellValue = cell.getValue(); if (cellValue == null) { return; } writer.startElement("row"); for (ColumnHandler columnHandler : columnHandlers) { columnHandler.write(writer, cell, members); } writer.endElement(); } }
/** * @see org.pivot4j.ui.AbstractPivotRenderer#getValue(org.pivot4j.ui.RenderContext) */ @Override protected Double getValue(ChartRenderContext context) { Double value = null; Cell cell = context.getCell(); if (cell != null && !cell.isEmpty()) { try { value = cell.getDoubleValue(); } catch (OlapException e) { throw new PivotException(e); } } return value; }
List<Integer> coords = cell.getCoordinateList(); CellSet cellSet = cell.getCellSet(); List<CellSetAxis> axes = cellSet.getAxes();
/** * @param cell * @return */ protected NumberFormat getNumberFormat(Cell cell) { NumberFormat format = null; String pattern = ObjectUtils.toString(cell .getPropertyValue(StandardCellProperty.FORMAT_STRING)); if (pattern != null && !"Standard".equals(pattern)) { try { format = new DecimalFormat(pattern); } catch (IllegalArgumentException e) { if (logger.isWarnEnabled()) { logger.warn("Illegal number format : {}", pattern); } } } if (format == null) { format = DecimalFormat.getNumberInstance(); } return format; }
/** * @see org.pivot4j.ui.command.UICommand#createParameters(org.pivot4j.ui.RenderContext) */ @Override public UICommandParameters createParameters(RenderContext context) { UICommandParameters parameters = new UICommandParameters(); List<Integer> list = context.getCell().getCoordinateList(); int[] coords = ArrayUtils.toPrimitive(list.toArray(new Integer[list.size()])); parameters.setCellCoordinate(coords); return parameters; }
/** * @param context * @return */ protected String getValueLabel(TableRenderContext context) { String label; Cell cell = context.getCell(); if (cell == null) { if (context.getAxis() == Axis.FILTER) { if (context.getMember() != null) { label = context.getMember().getCaption(); } else { label = context.getHierarchy().getCaption(); } } else { Aggregator aggregator = context.getAggregator(); if (aggregator == null) { label = null; } else { label = aggregator.getFormattedValue(context); } } } else { label = cell.getFormattedValue(); } return label; }
/** * @param cell * @return */ protected ResultSet performDrillThrough(Cell cell) { try { return cell.drillThrough(); } catch (OlapException e) { throw new PivotException(e); } }
return cell.getDoubleValue(); } catch (OlapException e) { throw new PivotException(e);
@Override public List<?> next() throws TranslatorException { if (!rowPositionIterator.hasNext()) { return null; } Position rowPosition = rowPositionIterator.next(); Object[] result = new Object[colWidth]; int i = 0; // add in rows axis List<Member> members = rowPosition.getMembers(); for (Member member:members) { String columnName = member.getName(); result[i++] = columnName; } // add col axis for (Position colPos : columnsAxis) { Cell cell = cellSet.getCell(colPos, rowPosition); result[i++] = cell.getValue(); } if (returnsArray) { ArrayList<Object[]> results = new ArrayList<Object[]>(1); results.add(result); return results; } return Arrays.asList(result); }
public Double getValue() { Double value = 0d; if (cell != null && !cell.isEmpty()) { try { value = cell.getDoubleValue(); } catch (OlapException e) { throw new PivotException(e); } } for (TreeNode<Member> child : getChildren()) { PlotNode node = (PlotNode) child; Double nodeValue = node.getValue(); if (nodeValue != null) { value += nodeValue; } } return value; }
/** * @see org.pivot4j.ui.command.UICommand#execute(org.pivot4j.PivotModel , * org.pivot4j.ui.command.UICommandParameters) */ @Override public ResultSet execute(PivotModel model, UICommandParameters parameters) { int[] array = parameters.getCellCoordinate(); List<Integer> coords = Arrays.asList(ArrayUtils.toObject(array)); Cell cell = model.getCellSet().getCell(coords); try { return cell.drillThrough(); } catch (OlapException e) { throw new PivotException(e); } } }
} else if (context.getCell().isEmpty()) { cellValue = null; } else { try { cellValue = context.getCell().getDoubleValue(); } catch (OlapException e) { throw new PivotException(e);