Search in sources :

Example 16 with Position

use of mondrian.olap.Position in project mondrian by pentaho.

the class RolapResult method populateEvaluator.

void populateEvaluator(Evaluator evaluator, int[] pos) {
    for (int i = -1; i < axes.length; i++) {
        Axis axis;
        int index;
        if (i < 0) {
            axis = slicerAxis;
            if (axis.getPositions().isEmpty()) {
                continue;
            }
            index = 0;
        } else {
            axis = axes[i];
            index = pos[i];
        }
        Position position = axis.getPositions().get(index);
        evaluator.setContext(position);
    }
}
Also used : Position(mondrian.olap.Position) QueryAxis(mondrian.olap.QueryAxis) Axis(mondrian.olap.Axis)

Example 17 with Position

use of mondrian.olap.Position in project pentaho-kettle by pentaho.

the class MondrianHelper method outputFlattenedRecurse.

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);
            }
        }
    }
}
Also used : Position(mondrian.olap.Position) Cell(mondrian.olap.Cell) Member(mondrian.olap.Member) Axis(mondrian.olap.Axis)

Aggregations

Position (mondrian.olap.Position)17 Member (mondrian.olap.Member)13 Axis (mondrian.olap.Axis)10 Result (mondrian.olap.Result)8 Cell (mondrian.olap.Cell)3 BigDecimal (java.math.BigDecimal)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 CellSetAxis (org.olap4j.CellSetAxis)2 DBCacheEntry (org.pentaho.di.core.DBCacheEntry)2 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)2 RowMeta (org.pentaho.di.core.row.RowMeta)2 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)2 ValueMetaBoolean (org.pentaho.di.core.row.value.ValueMetaBoolean)2 ValueMetaDate (org.pentaho.di.core.row.value.ValueMetaDate)2 ValueMetaInteger (org.pentaho.di.core.row.value.ValueMetaInteger)2 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)2 HashMap (java.util.HashMap)1 TupleList (mondrian.calc.TupleList)1 Hierarchy (mondrian.olap.Hierarchy)1