Custom Query Field filters

I have a following requirement that I am struggling to find a solution for:

I have a Company table where I have updated metadata and set CompanyID to EntityKey and CompanyName to EntityName
This is now allowing me to use this foreign fey in database table definitions ( Company -> CompanyID)

I have a query that is accepting numeric filter CompanyID.
I have another custom query (CompaniesFiltered) that produces list of CompanyID, CompanyName pairs based on specific filters (I usually returns less entries than full company table)

When I create dashboard I would like to create dashboard filter where I can select entries based on CompaniesFiltered but where companies are listed by name, but forwarded to dashboard query as numeric (ID) values

I tried converting this query to metadata and declaring column type to foreign key, here I can see Company -> CompanyID option, but CompanyID column is still displayed as integer.
In the definition Database Column this maps to is set to None
This is not same as database table metadata as in database tables it is allowing me to select display values column.

Also this foreign key option is only available for text fields, how can I achieve that this links to query numeric CompanyID filter field in dashboard.

Any help appreciated