Mike Robbins
12/30/2022, 9:56 PM${item.amount}
it will format to the correct currency for the transaction.
If we output ${groupTotals[item.lineuniquekey]}
, our custom calculated amount, it just outputs a straight number with no formatting. This value is being calculated in a function within the PDF template.
If we try to format the calculated value with ?string.currency
it always formats as USD currency with a dollar sign, comma and decimal point. Even when the standard formatting for Euro transactions is with the Euro symbol, a space for thousands separator and a comma for the decimal separator. ?string*(",##0.00")*
returns something similiar to USD all the time. Spaces don't work in that format string so I can't even hardcode format values for different currencies.
What can I do to format this number for the currency of the current transaction? Here's an example.suitemike
12/30/2022, 11:44 PMMike Robbins
12/31/2022, 12:58 AMNElliott
01/02/2023, 11:20 AMNElliott
01/02/2023, 11:23 AMscottvonduhn
01/03/2023, 2:39 PMnsformat_currency
, as documented here: https://suiteanswers.custhelp.com/app/answers/detail/a_id/26500/#subsect_156624108232
It is, by far, the best and easiest way to ensure that any custom or computed numeric value prints the way that it would have as if it were a currency field on the transaction.
Unless you are doing something that should always be in one currency, it’s best to NOT use the optional second parameter, as NetSuite will default to the transaction currency in that case.Mike Robbins
01/04/2023, 1:41 PM${nsformat_currency(groupTotal, record.currencysymbol)
Thank-you!!scottvonduhn
01/04/2023, 1:42 PMMike Robbins
01/04/2023, 1:43 PMscottvonduhn
01/04/2023, 1:43 PMMike Robbins
01/04/2023, 1:44 PMrender.transaction
and I'm using render.renderAsPdf
and passing in data.scottvonduhn
01/04/2023, 1:44 PMMike Robbins
01/04/2023, 1:45 PMscottvonduhn
01/04/2023, 1:45 PMscottvonduhn
01/04/2023, 1:47 PMMike Robbins
01/04/2023, 1:49 PMrenderAsString()
, escape a bunch of stuff, context.response.renderPdf(str)
. lolscottvonduhn
01/04/2023, 1:50 PM