resultIt.getValue( names[0] ); resultIt.getValue( names[1] );
String names[] = {"group_COUNTRY", "group_AMOUNT"};  GroupDefinition[] groupDefn = new GroupDefinition[]{ new GroupDefinition( "G1" ), new GroupDefinition( "G2" )}; groupDefn[0].setKeyExpression( "row.group_COUNTRY" );  groupDefn[1].setKeyExpression( "row.group_AMOUNT" );  String[] bindingNameRow = new String[3]; bindingNameRow[0] = "country"; bindingNameRow[1] = "amount"; bindingNameRow[2] = "binding3";  IBaseExpression[] bindingExprRow = new IBaseExpression[3]; bindingExprRow[0] = new ScriptExpression( "dataSetRow.COUNTRY" ); bindingExprRow[1] = new ScriptExpression( "dataSetRow.AMOUNT" ); bindingExprRow[2] = new ScriptExpression( "Total.sum( dataSetRow.AMOUNT,null,1)" );  createAndRunQuery( names, bindingExprGroup, groupDefn, null, null, null, null, null, null, bindingNameRow, bindingExprRow );  checkOutputFile( );
	public void test_RunningAggregationExpression() throws Exception	{		// Test a SQL with duplicate column name (quite common with join data sets)		String testSQL =  "select COUNTRY, AMOUNT from " + getTestTableName( );		((OdaDataSetDesign)this.dataSet).setQueryText( testSQL );				IBaseExpression[] expressions = new IBaseExpression[]{				new ScriptExpression( "row.COUNTRY", 0 ),				new ScriptExpression( "row.AMOUNT", 2 ),				new ScriptExpression( "Total.Sum( row.AMOUNT )", 2 ) };				String names[] = { "COL_COUNTRY", "COL_AMOUNT", "COL_SALE_DATE"};		GroupDefinition[] groupDef = new GroupDefinition[]{ new GroupDefinition( "G1" ), new GroupDefinition( "G2" ) };		groupDef[0].setKeyExpression(				"row.COUNTRY" );				groupDef[1].setKeyExpression("Total.Sum( row.AMOUNT,null,1 )");						// define a query design						QueryDefinition queryDefn = newReportQuery( );		queryDefn.addGroup( groupDef[0] );		queryDefn.addGroup( groupDef[1] );						queryDefn.addResultSetExpression( names[0], expressions[0] );		queryDefn.addResultSetExpression( names[1], expressions[1] );					IPreparedQuery preparedQuery = dataEngine.prepare( queryDefn );		IQueryResults queryResults = preparedQuery.execute( jsScope );		IResultIterator resultIt = queryResults.getResultIterator( );		assertTrue( resultIt.next() );		resultIt.getValue( names[0] );		resultIt.getValue( names[1] );			}