How do I utilize variables in rules?

In one of my hosts where i use the $HOSTNAME$ variable it is also inserted in the field for “Hosts name / IP address” and it is working without problem.
image