I have an issue with rounding in a saved search th...
# general
c
I have an issue with rounding in a saved search that I can’t figure out how to solve. I have and external system calling a RESTlet that returns the data from a saved search. This external system needs a couple of different transaction amount values and they must be returned with two decimals and the must add up. I’m calculating these amounts with various formulas (type currency) and the problem is that in some cases NetSuite rounds them to two decimals automatically and in some cases I have to make sure they are rounded and some times they end up having different decimals, one might have 210.00 and the other 210.01 for example. I think the problem has to do with the fact that I’m pulling some numbers from the transaction head (using the saved search Group function) and some from the transaction lines (using the saved search Sum function). Here are two example columns:
{fxamount}+({taxamount}/{exchangerate})
(Sum, these fields are from the transaction lines)
{total}/{exchangerate}
(Group, this is the total-field from the transaction head) I’ve tried wrapping them both in the
ROUND()
function because i thought that would “force” the same rounding principle on both of them, didn’t work. I’ve tried using
TRUNC({total}/{exchangerate}*100)/100
to just cut out the first two decimals, didn’t work. Does anyone have any idea on how to solve this? I have considered building a more complex formula where i check if the sum of the transaction lines differs by no more than 0.5 or something like that from the transaction total and if so use the same calculation on both columns just to make sure they are exactly the same. I know you can somehow use the
SUM()
function in a formula but haven’t figured out how to make i work…