Performing query on model with user submitted form parameters

Hi, i am new to yii. i am working on admin view to display records in CGridView along with advanced search form.Along with that i have to display the summary about the data currently displayed in CGridView.

So when user submits the advanced search form. i send that form in in seperate ajax call to my actionSummary to get latest summary.Following is the query i am trying to use to get records based on values user submitted.




$mv['totalOfficial'] = Iteration::model()->with(array('appPlatform','appPlatform.testType'=>array('condition'=>"testType.Name='Official'")))->count("t.AppPlatformId=:api AND SmokeStatusId=:ssi AND DetailedStatusId=:dspi AND JiraTicket=:jt AND IterationNumber=:in",array(':api'=>$model['AppPlatformId'],':ssi'=>$model->SmokeStatusId,':dsi'=>$model->DetailedStatusId,':jt'=>$model->JiraTicket,':in'=>$model->IterationNumber));



but above query does not return right results, may be because some parameters in $model recieved from ‘view’ are empty when user submits advanced search form.is there some elegant way to perform this query so that it neglects the missing parameters.i know that


$.fn.yiiGridView.update('user-grid', {data: $(this).serialize()}); 

, somehow updates the grid view even with some parameters missing but i dont know how it works.

Thanks for your kind help,