Welcome to another installment in our series of tips and tricks from the Polarion Software Technical Support team, in which we share solutions we provided to customers for real-world use cases that. The same tips might help you too, or others on your team. Let's look today at a couple of things with Velocity than can be frustrating until you know the trick.
Get rid of the text line when variable is not defined in Velocity.
The difference is what it does when 'variable' is not defined. In that case '$' renders the whole line as if it were plain text (which is not what you want in most cases), whereas '$' outputs nothing. So using '$' is usually a safer option.
#set($y = $null)
Output of $!y is:
Output of $y is: $y
Escaped special character (") doesn't work with Velocity.
We worked around the problem with quotes by saving the double quote character in to a variable x. (Please note the syntax ' " ' - without spaces).