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.
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
I have done something similar to this before.
%%=FormatNumber([Your Field], "N0", en-US)=%%
It will round up:
%%=v(formatnumber("1234.56","#,###")=%% yields 1,235
%%=FormatNumber([Your Field], "N0", en-US)=%% will not work. You need to add quotes around the “en-US”.
%%=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
%%=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
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0