How to filter the dynamic link type value

Hello all
I want if i am select for e.g doctype is company in child tabel so it’s showes all company in dynamic link field but i want it’s only show where tax_id is same where i right in parent form like

parent form field

tax_id is =1234567

child table

doctype dynamic link doctype
| |
company company1

so its only display where tax_id is same in parent form in this case company1 and company 2 tax id is same so it’s only display these two company not display company 3 . how can we do

Thanks in advance