In general, you can use displayField for some magic. 1. In your afterFind you can create a virtual field of those 3 values 2. You can set your displayField to that
3. If you want a more low level solution, try SQL VIEWS and CONCAT (for mysql) Disclaimer: I did not try the latter, but it should work. On Sep 19, 7:55 am, Marcelo Andrade <[email protected]> wrote: > On Wed, Sep 16, 2009 at 10:51 AM, Ernesto <[email protected]> wrote: > > > i have a model that's using a simple 3-columns table > > > item_id > > code > > description > > > i want to obtain a select box that shows the fields "code" and > > "description" concatenated. > > > right now i'm using a foreach loop > > > foreach ($items as $key => $item) $selectArray[$key] = $item["code"] . > > " - " . $item["description"]; > > > is there any way to do this directly in the "find" call? > > In the find call no, there isn't. But take a look at > Set::format. > > http://book.cakephp.org/view/672/format > > Best regards. > > -- > MARCELO DE F. ANDRADE > Belem, PA, Amazonia, Brazil > Linux User #221105 > > http://mfandrade.wordpress.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
