BaseQueryDefinition query = (BaseQueryDefinition) DataSetManager.getCurrentInstance( ) .getPreparedQuery( getDataSetHandle( ), true, false) .getReportQueryDefn( ); ScriptExpression expression = new ScriptExpression( getExpression( ) ); GroupDefinition defn = new GroupDefinition( ); defn.setKeyExpression( getExpression( ) ); query.setUsesDetails( false ); query.addGroup( defn ); query.addExpression( expression, BaseTransform.BEFORE_FIRST_ROW );
if(getExpression() != null && getExpression().trim().length() > 0) {  BaseQueryDefinition query = (BaseQueryDefinition) DataSetManager.getCurrentInstance( ) .getPreparedQuery( getDataSetHandle( ), true, false) .getReportQueryDefn( ); ScriptExpression expression = new ScriptExpression( getExpression( ) ); GroupDefinition defn = new GroupDefinition( ); defn.setKeyExpression( getExpression( ) ); query.setUsesDetails( false ); query.addGroup( defn ); query.addExpression( expression, BaseTransform.BEFORE_FIRST_ROW );
	private void populateList( )	{		try		{            this.okButton.setEnabled(false);			//Execute the query and populate this list			BaseQueryDefinition query = (BaseQueryDefinition) DataSetManager.getCurrentInstance( )					.getPreparedQuery( getDataSetHandle( ), true, false)					.getReportQueryDefn( );			ScriptExpression expression = new ScriptExpression( getExpression( ) );			GroupDefinition defn = new GroupDefinition( );			defn.setKeyExpression( getExpression( ) );			query.setUsesDetails( false );			query.addGroup( defn );			query.addExpression( expression, BaseTransform.BEFORE_FIRST_ROW );			IPreparedQuery preparedQuery = DataSetManager.getCurrentInstance( )					.getEngine( )					.prepare( (IQueryDefinition) query );			IQueryResults results = preparedQuery.execute( null );			selectValueList.removeAll( );			if ( results != null )			{				IResultIterator iter = results.getResultIterator( );				if ( iter != null )				{					while ( iter.next( ) )					{                        String value = iter.getString( expression );                        if(value != null)                        {                            selectValueList.add( value );                        }					}				}				results.close( );			}            if(selectValueList.getItemCount() > 0)            {                selectValueList.select(0);                this.okButton.setEnabled(true);            }		}		catch ( Exception e )		{			ExceptionHandler.handle( e );		}	}