Is anyone having trouble with decimal place displa...
# advancedpdf
m
Is anyone having trouble with decimal place displays? Seeing native behavior in the PDF template for not displaying the correct number of decimal places per currency. In general we want 2 decimal places (for cents) but I don't want to hard code that since we also support JPY which has 0 decimal places. As far as I know this used to be natively supported but it suddenly seems to be an issue? Values like $123.40 are displaying as $123.4 or $123.00 as $123 by using ${item.rate}/even on native fields
I'm worried that ?string.currency will simply always default to USD unless I'm re-defining locale each time? Is locale something that netsuite would pass as a variable?
I see
.locale
being referenced in the existing code but I imagine that's more of the user's locale vs determined by the currency of the transaction (which isn't necessarily equivalent to a locale anyway)
We even had ACS build in helpers for us like
${item.rate?string["#,##0.##"]}
before, which I think should be ensuring 2 decimal places? Except item.rate?string by itself is returning the 0s lopped off
r
have you tried using nsformat_currecy built in function?
m
I'm not familiar with that, is it something accessible on advanced pdf templates? Is there any help documentation you can point me toward? I ended up going with ?string[#,##0.00} for the moment, which adds unnecessary decimal places to Japanese yen but at least displays the correct signifiant figures for USD/EUR/etc
s
nsformat_currency()
is usually the preferred solution, as it respects the format options NetSuite uses for the transaction currency, and you don't need to worry about which currency it is.
?string.currency
will use whatever locale setting NetSuite's Java environment has.
?string["#,##0.##"]
simply limits the decimals to no more than two places, but does not ensure they will be displayed. It also means the thousands separator will always be a comma, and the decimal point character will always be a period. # will only display if the digit is not zero, 0 will always be displayed, even if the digit is zero. The problem is that values like 1.50 will display as 1.5, and a whole dollar amount won't have any decimals, regardless of the currency, so it should work fine for JPY, but it's not ideal for other currencies.
?string[#,##0.00]
will always display two decimal places, as you have seen. I would use
nsformat_currency()
unless you find it's not working as expected. Usually it's the best option, if the currency formats are setup correctly in NetSuite. The examples all show a second parameter, but if you don't set that, it uses the transaction's currency by default. It's better to not use the second parameter.
👍 1