本文整理汇总了Java中mondrian.olap.Result.getCell方法的典型用法代码示例。如果您正苦于以下问题:Java Result.getCell方法的具体用法?Java Result.getCell怎么用?Java Result.getCell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mondrian.olap.Result
的用法示例。
在下文中一共展示了Result.getCell方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCalcMemberWithNonEmptyCrossJoin
import mondrian.olap.Result; //导入方法依赖的package包/类
/**
* Make sure that the Crossjoin in [Measures].[CustomerCount]
* is not evaluated in NON EMPTY context.
*/
public void testCalcMemberWithNonEmptyCrossJoin() {
TestContext.instance().flushSchemaCache();
Result result = executeQuery(
"with member [Measures].[CustomerCount] as \n"
+ "'Count(CrossJoin({[Product].[All Products]}, [Customers].[Name].Members))'\n"
+ "select \n"
+ "NON EMPTY{[Measures].[CustomerCount]} ON columns,\n"
+ "NON EMPTY{[Product].[All Products]} ON rows\n"
+ "from [Sales]\n"
+ "where ([Store].[All Stores].[USA].[CA].[San Francisco].[Store 14], [Time].[1997].[Q1].[1])");
Cell c = result.getCell(new int[] {0, 0});
// we expect 10281 customers, although there are only 20 non-empty ones
// @see #testLevelMembers
assertEquals("10,281", c.getFormattedValue());
}
示例2: checkDrillThroughSql
import mondrian.olap.Result; //导入方法依赖的package包/类
private void checkDrillThroughSql(
Result result,
int row,
boolean extendedContext,
String expectedMember,
String expectedCell,
String expectedSql,
int expectedRows) throws Exception
{
final Member empMember =
result.getAxes()[1].getPositions().get(row).get(0);
assertEquals(expectedMember, empMember.getUniqueName());
// drill through member
final Cell cell = result.getCell(new int[]{0, row});
assertEquals(expectedCell, cell.getFormattedValue());
String sql = cell.getDrillThroughSQL(extendedContext);
getTestContext().assertSqlEquals(expectedSql, sql, expectedRows);
}
示例3: outputFlattenedRecurse
import mondrian.olap.Result; //导入方法依赖的package包/类
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<Object>(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);
}
}
}
}
示例4: outputFlattenedRecurse
import mondrian.olap.Result; //导入方法依赖的package包/类
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 );
}
}
}
}
示例5: testPropertyCaseSensitivity
import mondrian.olap.Result; //导入方法依赖的package包/类
/**
* Tests that property names are case sensitive iff the
* "mondrian.olap.case.sensitive" property is set.
*
* <p>The test does not alter this property: for testing coverage, we assume
* that you run the test once with mondrian.olap.case.sensitive=true,
* and once with mondrian.olap.case.sensitive=false.
*/
public void testPropertyCaseSensitivity() {
boolean caseSensitive = props.CaseSensitive.get();
// A user-defined property of a member.
assertExprReturns(
"[Store].[USA].[CA].[Beverly Hills].[Store 6].Properties(\"Store Type\")",
"Gourmet Supermarket");
if (caseSensitive) {
assertExprThrows(
"[Store].[USA].[CA].[Beverly Hills].[Store 6].Properties(\"store tYpe\")",
"Property 'store tYpe' is not valid for member '[Store].[All Stores].[USA].[CA].[Beverly Hills].[Store 6]'");
} else {
assertExprReturns(
"[Store].[USA].[CA].[Beverly Hills].[Store 6].Properties(\"store tYpe\")",
"Gourmet Supermarket");
}
// A builtin property of a member.
assertExprReturns(
"[Store].[USA].[CA].[Beverly Hills].[Store 6].Properties(\"LEVEL_NUMBER\")",
"4");
if (caseSensitive) {
assertExprThrows(
"[Store].[USA].[CA].[Beverly Hills].[Store 6].Properties(\"Level_Number\")",
"Property 'store tYpe' is not valid for member '[Store].[All Stores].[USA].[CA].[Beverly Hills].[Store 6]'");
} else {
assertExprReturns(
"[Store].[USA].[CA].[Beverly Hills].[Store 6].Properties(\"Level_Number\")",
"4");
}
// Cell properties.
Result result = executeQuery(
"select {[Measures].[Unit Sales],[Measures].[Store Sales]} on columns,\n"
+ " {[Gender].[M]} on rows\n"
+ "from Sales");
Cell cell = result.getCell(new int[]{0, 0});
assertEquals("135,215", cell.getPropertyValue("FORMATTED_VALUE"));
if (caseSensitive) {
assertNull(cell.getPropertyValue("Formatted_Value"));
} else {
assertEquals("135,215", cell.getPropertyValue("Formatted_Value"));
}
}