I have create a function in my model ot_note.php like
public function getOtServices(){
$instrumentsq= Yii::$app->db->createCommand
("SELECT group_concat(im.instrument_name)as instrument
from instrument_master im, ot_note otn, ot_instrument_entry oie where
otn.id=oie.ot_note_id and oie.instrument_name=im.id and otn.id=$this->id");
$instruments=$instrumentsq->queryScalar();
return $instruments;
}
Then in my index.php I have included the return value
like:
[
'label'=>'services',
'attribute'=>'otServices',
'value'=>'otServices'
],
in ot_note_search.php
public $otServices;
public function rules()
{
return [
['otServices'], 'safe'],
];
}
->andFilterWhere([ 'like', 'otServices' , $this->otServices ])
now the values in the column are shown correctly, but filter is not working and I am getting the sql error.
I need some help, how I should setup my filter on this calculated column.