Cgridview with dataprovider using sql function

Hi, I have a problem to display my data when I get it form a join with function on my dataprovider

the provider

$ProductDataProvider= new CActiveDataProvider(‘BusinessProduct’,



‘select’=>“t.productid,t.busid,coalesce(concat(‘en,’”.",’,group_concat(lang)),’“en”’) as languages",

‘join’=>‘left join bspd_business_product_lang b on t.productid = b.productid’,





the select return information on the product and a list of available language like

productid busid languages

1 1 en, fr, ko

2 4 en

for the product I want.

my problem is on the CGridView to display the data.

for the column languages, I must call a function to get flags

so , in columns I try to add something like

array(‘name’=>‘languages’, ‘value’=>getflags($data->languages),)…

but Yii says " CDBException Property "BusinessPromo.languages" is not defined.

I know its not define…but how to solve the problem

I think its a common problem every time we want to use group or join…

So how can we identify the name in the CGridview?

thanks for help

check this topic, it will help you

thanks a lot… after looking at your code, I just modify my model to add a new field $language, and it works …