use of mondrian.olap.Result in project mondrian by pentaho.
the class FunctionTest method testPropertiesFilter.
public void testPropertiesFilter() {
Result result = executeQuery("SELECT { [Store Sales] } ON COLUMNS,\n" + " TOPCOUNT(Filter( [Store].[Store Name].Members,\n" + " [Store].CurrentMember.Properties(\"Store Type\") = \"Supermarket\"),\n" + " 10, [Store Sales]) ON ROWS\n" + "FROM [Sales]");
Assert.assertEquals(8, result.getAxes()[1].getPositions().size());
}
use of mondrian.olap.Result in project mondrian by pentaho.
the class FunctionTest method testCurrentMemberFromAxis.
public void testCurrentMemberFromAxis() {
Result result = executeQuery("with member [Measures].[Foo] as" + " '[Gender].CurrentMember.Name" + " || [Marital Status].CurrentMember.Name'\n" + "select {[Measures].[Foo]} on columns,\n" + " CrossJoin({[Gender].children}," + " {[Marital Status].children}) on rows\n" + "from Sales");
Assert.assertEquals("FM", result.getCell(new int[] { 0, 0 }).getValue());
}
use of mondrian.olap.Result in project mondrian by pentaho.
the class FunctionTest method testCoalesceEmpty.
public void testCoalesceEmpty() {
// [DF] is all null and [WA] has numbers for 1997 but not for 1998.
Result result = executeQuery("with\n" + " member Measures.[Coal1] as 'coalesceempty(([Time].[1997], Measures.[Store Sales]), ([Time].[1998], " + "Measures.[Store Sales]))'\n" + " member Measures.[Coal2] as 'coalesceempty(([Time].[1997], Measures.[Unit Sales]), ([Time].[1998], " + "Measures.[Unit Sales]))'\n" + "select \n" + " {Measures.[Coal1], Measures.[Coal2]} on columns,\n" + " {[Store].[All Stores].[Mexico].[DF], [Store].[All Stores].[USA].[WA]} on rows\n" + "from \n" + " [Sales]");
checkDataResults(new Double[][] { new Double[] { null, null }, new Double[] { new Double(263793.22), new Double(124366) } }, result, 0.001);
result = executeQuery("with\n" + " member Measures.[Sales Per Customer] as 'Measures.[Sales Count] / Measures.[Customer Count]'\n" + " member Measures.[Coal] as 'coalesceempty(([Measures].[Sales Per Customer], [Store].[All Stores]" + ".[Mexico].[DF]),\n" + " Measures.[Sales Per Customer])'\n" + "select \n" + " {Measures.[Sales Per Customer], Measures.[Coal]} on columns,\n" + " {[Store].[All Stores].[Mexico].[DF], [Store].[All Stores].[USA].[WA]} on rows\n" + "from \n" + " [Sales]\n" + "where\n" + " ([Time].[1997].[Q2])");
checkDataResults(new Double[][] { new Double[] { null, null }, new Double[] { new Double(8.963), new Double(8.963) } }, result, 0.001);
result = executeQuery("with\n" + " member Measures.[Sales Per Customer] as 'Measures.[Sales Count] / Measures.[Customer Count]'\n" + " member Measures.[Coal] as 'coalesceempty(([Measures].[Sales Per Customer], [Store].[All Stores]" + ".[Mexico].[DF]),\n" + " ([Measures].[Sales Per Customer], [Store].[All Stores].[Mexico].[DF]),\n" + " ([Measures].[Sales Per Customer], [Store].[All Stores].[Mexico].[DF]),\n" + " ([Measures].[Sales Per Customer], [Store].[All Stores].[Mexico].[DF]),\n" + " ([Measures].[Sales Per Customer], [Store].[All Stores].[Mexico].[DF]),\n" + " ([Measures].[Sales Per Customer], [Store].[All Stores].[Mexico].[DF]),\n" + " ([Measures].[Sales Per Customer], [Store].[All Stores].[Mexico].[DF]),\n" + " ([Measures].[Sales Per Customer], [Store].[All Stores].[Mexico].[DF]),\n" + " Measures.[Sales Per Customer])'\n" + "select \n" + " {Measures.[Sales Per Customer], Measures.[Coal]} on columns,\n" + " {[Store].[All Stores].[Mexico].[DF], [Store].[All Stores].[USA].[WA]} on rows\n" + "from \n" + " [Sales]\n" + "where\n" + " ([Time].[1997].[Q2])");
checkDataResults(new Double[][] { new Double[] { null, null }, new Double[] { new Double(8.963), new Double(8.963) } }, result, 0.001);
}
use of mondrian.olap.Result in project mondrian by pentaho.
the class FunctionTest method testBasic.
public void testBasic() {
Result result = executeQuery("select {[Gender].[M].PrevMember} ON COLUMNS from Sales");
assertEquals("F", result.getAxes()[0].getPositions().get(0).get(0).getName());
}
use of mondrian.olap.Result in project mondrian by pentaho.
the class FunctionTest method testBasic2.
public void testBasic2() {
Result result = executeQuery("select {[Gender].[F].NextMember} ON COLUMNS from Sales");
assertEquals("M", result.getAxes()[0].getPositions().get(0).get(0).getName());
}
Aggregations