How can I check if a variable is set?

Have you tried ${myvar??} ? The double question mark usually checks in freemarker if a variable exists. I don’t know if it works on a gateway as well but you could give it a try.