This is according to the documentation:

=====================================
If you need to use SQL operators such as in (MySQL) DISTINCT, MAX,
MIN, etc... you can specify it as part of the 'fields' key, as such:
    $this->Product->find('all', array('fields'=>'DISTINCT
(Product.name) AS product_name'));

=====================================

But that is not working for me.  I would rather limit in the query
than passing it to PHP.  If thats my only option, then I will oblige
but there has got to be a way to do this.

On Feb 4, 11:47 am, czarcrab <[email protected]> wrote:
> 2 ways about it.
>
> One, switch on debug=1 (atleast) in core.php.  This should give you
> the query and some indication on how to fix it.
>
> Two, if the idea is to limit the amount of characters displayed in the
> view, then handle it in the index.ctp like this
>
> echo "<td>".(strlen($data['records'][$i][$field["table"]][$field
> ["title"]]) > 25?substr($data['records'][$i][$field["table"]][$field
> ["title"]],0,22)."...":$data['records'][$i][$field["table"]][$field
> ["title"]] )."&nbsp;</td>";
>
> On Feb 4, 12:28 pm, gkc <[email protected]> wrote:
>
> > I need to limit the amount of characters returned on a field.
>
> > I have tried using 'fields'=>array('LEFT(field,200) AS \'field\'') but
> > I get an undefined index: field error when I do this.
>
> > Any suggestions would be greatly appreciated.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to