Database Reference
In-Depth Information
All Essbase operations are implemented in the Java API as a subclass of the
IEssOperation class. Instances of the operations are created by the cubeview object
using the common Factory method pattern to simplify the object creation. The opera-
tion object is then passed as an argument to the cubeview's performOperation method
for execution.
// create the operation
IEssOpRetrieve retrieve = cv.createIEssOpRetrieve();
// perform the operation
cv.performOperation(retrieve);
once the operation is complete, you need to read the results on a cell-by-cell basis.
most algorithms for reading the grid use a nested loop algorithm that loops through
each column of each row and processes the data in each cell. What you do with the data
from the cells is your business, but most commonly the data may be written to a file,
written to an htmL file, or formatted for use in a spreadsheet.
// now read the results
// loop the rows
for (int row = 0; row < gv.getCountRows(); row++) {
// loop the columns in the row
for (int col = 0; col < gv.getCountColumns(); col++) {
// print the values tab delimited
System.out.print(gv.getValue(row, col));
// print a tab character between cells
System.out.print("\t");
}
// print a newline character between rows
System.out.print("\n");
}
There are a few things to note about this example. First, when looping through
the rows and columns of the internal grid, make sure to read the grid size from the
IEssGridView.getCountRows and IEssGridView.getCountColumns methods. During
Essbase operations, such as zoom In, it is fairly obvious that the grid metrics will
change. The grid metrics can change, though, even in the case of a simple retrieve. For
example, when you change the IEssCubeView.setUseBothForRowDimensions property
from false to true, the grid will grow by at least one column to accommodate both
the member name and alias in separate columns. retrieve operations with suppress
missing turned on also will frequently change the grid size. Further, for optimization
in a production application, you would normally set up the loops with variables that
store the row count and column counts, as accessing the IEssGridView.getCountRows
and IEssGridView.getCountColumns methods during each loop incurs unnecessary
overhead.
In this simple example, the algorithm is getting the string representation of the value
of the cell. The output from this operation looks much like a retrieval using Smart view.
Actual
New York
Sales
Qtr1
Qtr2
Qtr3
Qtr4
Product
7705.0
9085.0
9325.0
8583.0
Search WWH ::




Custom Search