# Multiple setDisplayField method

**URL:** <https://discourse.cakephp.org/t/multiple-setdisplayfield-method/8726>\
**Category:** Need Help\
**Created:** [December 12, 2020, 9:54am UTC](https://discourse.cakephp.org/t/multiple-setdisplayfield-method/8726 "2020-12-12T09:54:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![werkudara](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/werkudara/32/1772_2.png) [@werkudara](https://discourse.cakephp.org/u/werkudara)\
**Post date:** [December 12, 2020, 9:54am UTC](https://discourse.cakephp.org/t/multiple-setdisplayfield-method/8726/1 "2020-12-12T09:54:09Z")

</div>

Hello guys, I need help  
How I can make the setDisplayField method showing multiple fields  
this is my ParentModel  
$this-\>setDisplayField([‘father\_name’,‘mother\_name’]);

it will show the fatherName;motherName,

Could we add a separator between that 2 field names?  
thankyou

---

<div class="post-metadata">

**Author:** ![ADmad](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/admad/32/20_2.png) [@ADmad](https://discourse.cakephp.org/u/ADmad)\
**Post date:** [December 12, 2020, 12:28pm UTC](https://discourse.cakephp.org/t/multiple-setdisplayfield-method/8726/2 "2020-12-12T12:28:04Z")

</div>

Use [virutal fields](https://book.cakephp.org/4/en/orm/entities.html#creating-virtual-fields) for what you need. Create a virtual field named `full_name` which returns the value you need. Then in your `find('list')` call set the `valueField` option to `full_name`.

---

<div class="post-metadata">

**Author:** ![werkudara](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/werkudara/32/1772_2.png) [@werkudara](https://discourse.cakephp.org/u/werkudara)\
**Post date:** [December 12, 2020, 2:14pm UTC](https://discourse.cakephp.org/t/multiple-setdisplayfield-method/8726/3 "2020-12-12T14:14:19Z")

</div>

Thank you so much it works  
protected function \_getParentName()  
{  
return $this-\>father\_name . ’ - ’ . $this-\>mother\_name;  
}
