Today's Pro Tip is on a very powerful ESM Variable: Evaluate Velocity Template (EVT) which allows you to leverage the Velocity Template Language within a resource such as a Rule or Query.
Let us take a look at how to use the EVT variable to apply the classic programming logic (IF/Then/Else) to replace a blank device hostname with a device's IP address in a rule action. Of course you can adapt this method to solve all kinds of problems and other EVT functions which we will cover in future Pro Tips.
First within your rule add the fields you would like to use in your EVT as aggregate fields.
Next add a new EVT local variable (EVT is located in the String category).
Now you get a simple Text Box to enter in your values:
#if ($deviceHostName != "")$deviceHostName #elseif ($deviceHostName == "")$deviceAddress#end
Make sure you enter it all on one line (EVT does not know how to evaluate newline characters). Also make sure there is a white space after each function ie. #if<space>($blah)
Now use the rule Action "Set Event Field" to overwrite deviceHostname with the EVT variable "checkhostnull".
And finally add $checkhostnull variable as an aggregated field.
That's all there is to it...
Hope this helps you develop some killer content!