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
On Wed, Sep 16, 2009 at 10:51 AM, Ernesto 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
@brian:
find('list') doesn't allow you to concatenate fields, because you
don't have all the fields you need. Think you have a model, like id-
name-lastname user, and you want back from db a list of all user like
id => name+lastname
you cannot use find('list'). First of all, you need find('
@santino83: That should be, "... you should use find('list') to get a list ..."
On Thu, Sep 17, 2009 at 7:10 AM, Thiago Nuic Vidigal wrote:
> teknoid has a post on his blog about a "superlist" that does what you want.
>
>
>
> On Wed, Sep 16, 2009 at 11:14 AM, santino83 wrote:
>>
>> Hi,
>>
>> Fi
BTW this feature should be built-in in Cake
On 17 Set, 13:46, Ernesto wrote:
> u mean this?
>
> http://teknoid.wordpress.com/2008/09/04/findlist-with-three-or-combin...
>
> very good article.
>
> thx
>
> On 17 Set, 13:10, Thiago Nuic Vidigal wrote:
>
>
>
> > teknoid has a post on his blog about
u mean this?
http://teknoid.wordpress.com/2008/09/04/findlist-with-three-or-combined-fields/
very good article.
thx
On 17 Set, 13:10, Thiago Nuic Vidigal wrote:
> teknoid has a post on his blog about a "superlist" that does what you want.
>
>
>
> On Wed, Sep 16, 2009 at 11:14 AM, santino83 w
teknoid has a post on his blog about a "superlist" that does what you want.
On Wed, Sep 16, 2009 at 11:14 AM, santino83 wrote:
>
> Hi,
>
> First of all you should use find('first') to get a list from your
> model. As you can read in http://book.cakephp.org/view/810/find-list,
> you could set $
Hi,
First of all you should use find('first') to get a list from your
model. As you can read in http://book.cakephp.org/view/810/find-list,
you could set $displayField in Model and tell to cake which field it
should use as "description". In your case, it seems cake couldn't
concatenate fields as
Hello.
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"] .
" - " . $it