Move items to various board groups based on linked boards column value

Hi,
I have a list of items, and I want them to auto group based on a value sitting in a linked-boards column.

e.g.
Item x associated with item X - I want it to be moved under a group named X.
Item Y assoiciated with item Y - I want it to be moved under a group name Y.
And so on.

Thanks!