2

Is it possible to format a number field to put in the commas separating thousands? So 1000000 becomes 1,000,000.

I found FormatNumber but it doesn't look like it does the trick. http://help.exacttarget.com/en-US/documentation/exacttarget/content/ampscript/ampscript_syntax_guide/utilities_ampscript_functions/#FormatNumber

Thanks!

4 Answers 4

3

I have done something similar to this before.

Try %%=FormatNumber([Your Field], "N0", en-US)=%%

3

Try this:

%%=formatnumber(@field,"#,###")=%%    

It will round up:

%%=v(formatnumber("1234.56","#,###")=%%    
yields
1,235    
2

%%=FormatNumber([Your Field], "N0", en-US)=%% will not work. You need to add quotes around the "en-US".

Example:

%%=FormatNumber([Your Field], "N", "en-US")=%%

If you want it to limit the number of decimal places just add a # after the "N" of places you would like. If you only put "N" with no number it will keep all the places in the original number.

You can see all the FormatNumber options here: https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-programmatic-content.meta/mc-programmatic-content/FormatNumber.htm

0

%%=FormatNumber([Your Field], "N0", en-US)=%% caused a error in send, but when I added the quotes to "en-US". The email came through. So I used: %%=FormatNumber([Your Field], "N0", "en-US")=%%

Here's the Marketing Cloud error the first one sent.

--- inner exception 1--- ExactTarget.OMM.InvalidScriptException: An error occurred when attempting to resolve a function call. See inner exception for detail. Function Call: FormatNumber(@UsageHours, "N0", en-US) Index: 2341 TransCode Type: HTML Content Type: HTML Substitution Level: Subscriber Message Context: Send Error Code: OMM_SCRIPT_SYNTAX_ERR - from OMMCommon -->

--- inner exception 2--- ExactTarget.OMM.InvalidFunctionException: The specified attribute or custom object field name was not found for this client. Function Call: FormatNumber(@UsageHours, "N0", en-US) Attribute or Field Name: en-US Error Code: OMM_FUNC_SYNTAX_ERR - from OMMCommon

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .