Hello,
I have been trying to fix this problem reading a lot of post , searching on internet but i couldn’t.
I have the delimitedcolumn in the db with values like 123x456x789 and I would like to filter this values using the >, = and < operators.
I created a dummy page to get the strings splited:
$delimitedvalues = '123x456x789';
$first = substr($delimitedvalues,0,strpos($delimitedvalues,'x'));
$second = substr(substr($delimitedvalues,strpos($delimitedvalues,'x')+1),0,strpos(substr($delimitedvalues,strpos($delimitedvalues,'x')+1),'x'));
$third = substr(substr($delimitedvalues,strpos($delimitedvalues,'x')+1),strpos(substr($delimitedvalues,strpos($delimitedvalues,'x')+1),'x')+1);
echo $first;
echo '</br>';
echo $second;
echo '</br>';
echo $third;
but now I want to get all values that in the first part are greater than 123, then the second and third part but using the CDBCriteria.
I tried with this 3 examples but it didnt work.
$criteria->compare('substr(t.delimitedcolumn,0,strpos(t.delimitedcolumn,"x"))',$this->pieces,true);
//$criteria->select = '*,substr(t.delimitedcolumn,0,strpos(t.delimitedcolumn,"x"))';
//$criteria->addCondition('substr(t.delimitedcolumn,0,strpos(t.delimitedcolumn,"x"))');
also I tried to use the self::STAT in the model as following but the alias column was not found:
'delimitedcolumn_alias'=>array(self::STAT, 'Piece', 'id_piece',
'select' => 'substr(t.delimitedcolumn,0,strpos(t.delimitedcolumn,"x"))'
Any ideas ? any help it will appreciate it.
Thanks.