while( instId != null && (dataId = instId.getDataID( )) == null ){
while( instId != null && dataId == null ){
	public IExtractionResults extract( ) throws EngineException	{		if( instanceId == null ) 			return null;		DataEngine dataEngine = executionContext.getDataEngine().getDataEngine();				DataID dataId = instanceId.getDataID();		InstanceID instId = instanceId;		while( instId != null && (dataId = instId.getDataID( )) == null ){			instId = instId.getParentID( );		}				if(dataId == null)			return null;				DataSetID dataSetId = dataId.getDataSetID( );		assert dataSetId != null;		String queryResultName = dataSetId.getDataSetName( );				if ( queryResultName != null )		{			try			{				IQueryResults queryResults = executionContext.getDataEngine( ).getDataEngine( )						.getQueryResults( queryResultName );								if( queryResults.getResultIterator() == null )					return null;								return new ExtractionResults( queryResults.getResultIterator() );							}			catch ( BirtException e )			{				e.printStackTrace();			}		}		else		{			DataSetID parentId = dataSetId.getParentID( );			assert parentId != null;			try			{				queryResultName = parentId.getDataSetName( );				assert queryResultName != null;				IQueryResults parentQueryResult = dataEngine						.getQueryResults( queryResultName );				IResultIterator iter = parentQueryResult.getResultIterator( );				long rowid = dataSetId.getRowID( );				int i = 0;				while ( iter.next( ) && i++ < rowid ) 		;								IResultIterator subIter = iter.getSecondaryIterator( dataSetId						.getQueryName( ), executionContext.getScope( ) );				return new ExtractionResults( subIter );			}			catch( BirtException be )			{				be.printStackTrace( );			}		}				return null;	}