${item.netamount?string?replace('[^\\.,0-9]','','r...
# advancedpdf
d
${item.netamount?string?replace('[^\\.,0-9]','','r')?number / item.quantity}
e
try item.netamount?string.number?replace
d
failed
Error details :left-hand operand: Expected a hash, but this has evaluated to a string (wrapper: f.t.SimpleScalar): ==> item.netamount?string [in template "template" at line 190, column 25] ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign val = item.netamount?string.n... [in template "template" at line 190, column 10]
s
have you just tried
${item.netamount / item.quantity}
? Usually Freemarker will convert the currency value to a number automatically, though there are some situations where it cannot. If that does not work, you could make a Transaction Line currency formula field that does this calculation, then use that custom line field directly in the template.
d
I tried this @scottvonduhn
${item.netamount / item.quantity} whcih failed then i tried different methods
@scottvonduhn for transaction currency formula field, do i need to use the same formula {item.netamount / item.quantity}
s
It might be either
{item.netamount} / {item.quantity}
or
{netamount} / {quantity}
, I can't remember which
for the formula field
👍 1
c
You can also just do the math in netsuite and pull the field over and avoid having the PDF do business logic and calculations.
👍 3
d
Hi @scottvonduhn, @creece this one worked, but curious to know from where the netamount is being fetched. few records this worked well, But few records netamount displays wrong value