Tuesday, April 10, 2012

Re: Multiple Display Filed

This works in 1.3:

var $displayField = 'full_name';
function __construct($id = false, $table = null, $ds = null) {
parent::__construct($id, $table, $ds);
$this->virtualFields['full_name'] = sprintf('CONCAT(%s.first_name, " ", %s.last_name)', $this->alias, $this->alias);
}

Then full_name is available as a field in all finds.

Jeremy Burns
Class Outfit

Tel: +44 (0) 208 123 3822
Mob: +44 (0) 7973 481949
Skype: jeremy_burns
http://www.classoutfit.com


Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 10 Apr 2012, at 07:17:04, Reza Talamkhani wrote:

Hi,
I need to concat first_name and last_name as full_name and set displayname to it.

fullname <= concat(first_name, ' ', last_name)

please help me...

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: