prepareAndCommit();
// Create a Cursor for unitPriceByMonth.
CursorManagerSpecification cursorMngrSpec =
dp.createCursorManagerSpecification(unitPriceByMonth);
SpecifiedCursorManager cursorMngr =
dp.createCursorManager(cursorMngrSpec);
CompoundCursor rootCursor = (CompoundCursor) cursorMngr.createCursor();
// Get the outputs and the ValueCursor.
List outputs = rootCursor.getOutputs();
// The first output has the values of timeSel, the slower varying output.
ValueCursor rowCursor = (ValueCursor) outputs.get(0);
// The second output has the faster varying values of prodSel.
ValueCursor columnCursor = (ValueCursor) outputs.get(1);
// The base ValueCursor has the values from unitPrice.
ValueCursor unitPriceValues = rootCursor.getValueCursor();
// Display the values as a crosstab.
println("\t PRODUCT_AW");
println("\t-----------------------");
print("Month");
do
{
String value = ((ValueCursor) columnCursor).getCurrentString();
print("\t" + getContext().getLocalValue(value) + " ");
}
while (columnCursor.next());
println("\n-----\t-------\t-------\t-------");
// Reset the column Cursor to its first element.
columnCursor.setPosition(1);
do
{
// Print the row dimension values.
String value = ((ValueCursor) rowCursor).getCurrentString();
print(getContext().getLocalValue(value) + "\t");
// Loop over columns.
do
{
// Print the data value.
print(unitPriceValues.getCurrentValue() + "\t");
}
while (columnCursor.next());
println();
// Reset the column Cursor to its first element.
columnCursor.setPosition(1);
}
while (rowCursor.next());
cursorMngr.close();
}