We have an attribute that represents the number of messages a particular user has sent. Because it seems weird to list the exact number, we want to round this to the closest hundred value. I assume velocity is the way to go and came up with the following but it failed to populate (just remained blank in the sample email send with a confirmed non null value)

#set ($rounded_number = $math.roundTo(2, ${lead.Message_Volume__c_contact}))

Additionally, over tens of thousands of messages, it would be helpful to have the usual (US format) commas in place for sets of 3 orders of magnitude.

Any advice or direction would be much appreciated.

First: don't use ${formal} references in function calls. They lead to syntax errors because they can't be chained.

Second: $math.roundTo rounds to

decimal places.That's not thesame as "closest hundred." (It also doesn't accept negative decimal places.)Third: because of the oversimplification of $math.round (which always uses HALF_EVEN rounding) and Velocity's rather tragic verbosity you need this:

There are some alternate ways with $math.mod but none are as flexible, nor do they use real mathematical methods.

Fourth: the US locale commas are simple: