QueryDefinition queryDefn = newReportQuery( );
String[] bindingNameRow = new String[6]; bindingNameRow[0] = "ROW_0"; bindingNameRow[1] = "ROW_rowPosition"; bindingNameRow[2] = "ROW_COUNTRY"; bindingNameRow[3] = "ROW_CITY"; bindingNameRow[4] = "ROW_SALE_DATE"; bindingNameRow[5] = "ROW_AMOUNT"; IBaseExpression[] bindingExprRow = new IBaseExpression[6]; bindingExprRow[0] = new ScriptExpression( "dataSetRow[0]" ); bindingExprRow[1] = new ScriptExpression( "dataSetRow._rowPosition" ); bindingExprRow[2] = new ScriptExpression( "dataSetRow.COUNTRY" ); bindingExprRow[3] = new ScriptExpression( "dataSetRow.CITY" ); bindingExprRow[4] = new ScriptExpression( "dataSetRow.SALE_DATE" ); bindingExprRow[5] = new ScriptExpression( "dataSetRow.AMOUNT" );  GroupDefinition[] groupDefn = null; SortDefinition[] sortDefn = null;
	public void test_FilteWithTopN() throws Exception	{		// Test a SQL with duplicate column name (quite common with join data sets)		String testSQL =  "select COUNTRY, AMOUNT from " + getTestTableName( ); //$NON-NLS-1$		((OdaDataSetDesign)this.dataSet).setQueryText( testSQL );				ScriptExpression[] expressions = new ScriptExpression[2];		expressions[0] = new ScriptExpression( "row.COUNTRY" ); //$NON-NLS-1$		expressions[1] = new ScriptExpression( "row.AMOUNT" ); //$NON-NLS-1$			FilterDefinition filterDef = new FilterDefinition (				new ConditionalExpression("row.AMOUNT",IConditionalExpression.OP_TOP_N,"1") );  //$NON-NLS-1$//$NON-NLS-2$				// define a query design						QueryDefinition queryDefn = newReportQuery( );						queryDefn.addFilter( filterDef );				queryDefn.addResultSetExpression( "COL_COUNTRY", expressions[0] ); //$NON-NLS-1$		queryDefn.addResultSetExpression( "COL_AMOUNT", expressions[1] );	 //$NON-NLS-1$				IPreparedQuery preparedQuery = dataEngine.prepare( queryDefn );		IQueryResults queryResults = preparedQuery.execute( null );		IResultIterator resultIt = queryResults.getResultIterator( );		outputQueryResult( resultIt, new String[]{ "COL_COUNTRY", "COL_AMOUNT"} );	  //$NON-NLS-1$//$NON-NLS-2$		checkOutputFile( );		}