Using Aggregate Values In Cgridview Using Cactivedataprovider

dear friends I want to display the total number of medicines does the order has in the grid view using active data provider… like this


but I got the error

I count this value in criteria as

‘select’=>’ count(medicine) AS totalMedicines’,

help me

Hello Dear !!!

Just define " totalMedicines " property in ur Model Class like this

public $totalMedicines;

your solution is here…

please see it…

I saw your reply…,

I did like this in the criteria and pass it to cactivedataprovider except I dont have such a variable like the above

$TotalDt is this really works? does the summed value stored to this variable? …

Yes in my provious comment it’s work fine…please try it…and stored the value on varible so please wirte a query and pass the criteria…so it’s work fine and return the $TotalDt

for example…

$sumDT =  DayaTampungS1::model()->findAll($criteria);