populating Cgrid view using innerjoins in Cdbcriteria

hi all…

i want to populate cgridview using the search function slightly modified. i have innerjoin d various tables now i cannot display the result oh the function in my cgridview (Cdbcriteria)


public function fluctuation()

	{

		$criteria=new CDbCriteria;


	// $criteria->params = array(":cat_id" =>$this->cat_id);

	

	 if(($this->location_id) &&($this->product_id))

	 {

		 

		  $location_id=$this->location_id;

		  $product_id=$this->product_id;

		 // $month=$this->invoice_no;

			$criteria->select='mn.rate as min_rate,mx.rate as max_rate,mx.month as month,sp.quantity_left as quantity_left,p.product_name as product_name';

			$criteria->join='INNER JOIN max_rate_per_product as mx on t.product_id=mx.product_id inner join min_rate_per_product as mn on mx.product_id=mn.product_id inner join stock_present_monthwise1 as sp on mx.product_id=sp.product_id inner join products as p on p.product_id=mx.product_id';


		 $criteria->params = array(":location_id" =>$this->location_id,":product_id" =>$this->product_id); 

		 //$criteria->params = array(":cat_id" =>$this->cat_id); 

 $criteria->condition = "mx.product_id=:product_id and mx.location_id=:location_id group by mx.month ";

	 }

	 

	




//select mn.rate,mx.rate,mx.month,sp.quantity_left,p.product_name from max_rate_per_product as mx inner join min_rate_per_product as mn on mx.product_id=mn.product_id inner join stock_present_monthwise1 as sp on mx.product_id=sp.product_id inner join products as p on p.product_id=mx.product_id where mx.product_id=2 group by mx.month







		 ProductUpdate::model()->findAll($criteria);		

		  $data= new CActiveDataProvider(get_class($this), array(

			'criteria'=>$criteria,

		)); 	

		 $_SESSION['Stock-excel']=$data; // get all data and filtered data <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/smile.gif' class='bbc_emoticon' alt=':)' /> 

 

        return $data;

		

	}

now how do i get these fields in my cgridview

anyone… any idea?? i tried $data->min_rate and $dataprovider->min_rate.$data gave an error saying productUpdate.min_rate is undefined and for $dataprovider it gave correct number of rows but the columns were empty…

here’s my grid code:


$this->widget('zii.widgets.grid.CGridView', array(

	'id'=>'product-update-grid',

	'dataProvider'=>$model->fluctuation(),

	

	'columns'=>array(array( 

        'name'=>'id', 

        'value'=>'$this->grid->dataProvider->getPagination()->getOffset()+$row+1', 

        'header'=>'Sr No.', 

        'filter'=>false, 

),


//'product_name',

array('header'=>'Product', 'value'=>'$dataprovider->product_name'),

//array('header'=>'Month', 'value'=>'$this->grid->dataProvider->month'),


'quantity_left',

//'min_rate',

//'max_rate',


	

		

		

		

	),

));