Using dashboard variable in loki query

Hi. I’m implementing a network switch dashboard. It have some variables to choose which switch data visualize, this is working fine.
Yesterday I installed loki, and now I want to integrate the network switch logs to the network dashboard.
But I can’t. The problem is that in the dashboard, the variable “switch” get the network switch name from a prometheus query, and it just the name with no domain. And in the loki data the hostname is with the domain, switch.example.com.
This is the loki query that I am trying to use, but it’s not working

{hostname=~“$switch.+”} |= ``

I’ve tryed with {{}} but not luck.
O.S redhat linux 8
Grafana version 10.2.1
Loki version 2.9.4

Thanks in advance for any comment.