Q:

Value from custom column in TCA select

I created a select in Typo3 TCA, it's looks like this:
'company_address' => array(
  'exclude' => 1,
  'label' => 'Company Address',
  'config' => array(
    'type' => 'select',
    'foreign_table' => 'pages',
            'foreign_table_where' => ' AND doktype = 75',
            'items' => array(
                array('', 0)
            ),
    'maxitems' => 1
  )
    ),

By default value = uid of record, how to change this ?
I need that value = my_column. Is it possible ?

A:

You can use a itemProcFunc to build your select options like you need them to be. In your TCA you change the config:
'company_address' => array(
  'config' => array(
    'type' => 'select',
    'itemsProcFunc' => 'Vendor\\MyExt\\UserFunc\\TcaProcFunc->companyAddressItems'
    'maxitems' => 1
  )
)

You can implement your custom function then. I'll give you an example
namespace Vendor\MyExt\UserFunc;
class TcaProcFunc
{   
    /**
     * @param array $config
     * @return array
     */
    public function companyAddressItems($config)
    {
        $itemList = [];
        $rows = $this->getMySpecialDokTypeRowsFromDb();
        foreach ($rows as $row) {
            $itemList[] = ['Label of the item', $row['my_column']];
        }
        $config['items'] = $itemList;
        return $config;
    }
}

Whatever you store in $config['items'] will be the item List in your select box. To make this (untested) example work you have of course implement the method getMySpecialDokTypeRowsFromDb(). 

