BaseQueryDefinition query = (BaseQueryDefinition) DataSetManager.getCurrentInstance( ) .getPreparedQuery( getDataSetHandle( ), getBindingParams( ), 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( ); modelValueList.clear(); viewerValueList.clear();  if ( results != null )
Iterator iter = modelValueList.iterator(); while( iter.hasNext()){ Object candiateValue = iter.next(); if ( candiateValue != null )
	private void populateList( )	{		try		{			this.okButton.setEnabled( false );			if ( getExpression( ) != null					&& getExpression( ).trim( ).length( ) > 0 )			{				//Execute the query and populate this list				//                BaseQueryDefinition query = (BaseQueryDefinition)				// DataSetManager.getCurrentInstance( )				//                        .getPreparedQuery( getDataSetHandle(				// ),true, false)				//                        .getReportQueryDefn( );				BaseQueryDefinition query = (BaseQueryDefinition) DataSetManager.getCurrentInstance( )						.getPreparedQuery( getDataSetHandle( ),								getBindingParams( ),								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( );				modelValueList.clear();				viewerValueList.clear();								if ( results != null )				{					IResultIterator iter = results.getResultIterator( );					if ( iter != null )					{						while ( iter.next( ) )						{							Object candiateValue = iter.getValue( expression );							if ( candiateValue != null )							{								modelValueList.add( candiateValue );								String displayCandiateValue;								if ( candiateValue instanceof Date )									displayCandiateValue = ParameterValidationUtil.getDisplayValue( DesignChoiceConstants.PARAM_TYPE_DATETIME,											null,											candiateValue );								else									displayCandiateValue = DataTypeUtil.toString( candiateValue );								viewerValueList.add( displayCandiateValue );								selectValueList.add( displayCandiateValue );							}						}					}					results.close( );				}			}			else			{				selectValueList.removeAll( );				modelValueList.clear();				viewerValueList.clear();				ExceptionHandler.openErrorMessageBox( Messages.getString( "SelectValueDialog.errorRetrievinglist" ), Messages.getString( "SelectValueDialog.noExpressionSet" ) ); //$NON-NLS-1$ //$NON-NLS-2$			}			if ( selectValueList.getItemCount( ) > 0 )			{				selectValueList.select( 0 );				this.okButton.setEnabled( true );			}		}		catch ( Exception e )		{			ExceptionHandler.handle( e );		}	}