So, I’m summing up a list field, making sure to convert the text field with numbers with @tonumber.Sometimes @sum returns the right answer, and sometimes it is off by one decimal digit!
Eg.
@Sum(@ToNumber(fieldname));
Values in fieldname are:
69231
92308
105000
25385
Total should be: 291924
But result of @sum returns 291923.
Any ideas? I’ve searched this forum, but no luck.
TIA
Subject: @sum weirdness
Hi,
I created a field with this formula
@Sum(69231:92308:105000:25385)
and it does return 291924. Do you get that result only when you use the field name variable?
Padma
Subject: RE: @sum weirdness
Hi Padma
Yes, I plugged in your suggestion and it also returned the correct value.
I apologize for the oversight, but I am using @getfield in the formulas as well…
x:=@TONUMBER(@GetField(fieldName));
@SUM(X)
Subject: @sum weirdness - resolved
For some reason it doesn’t like @sum, forced to round each individual values in a for loop like so:
lList:=@GetField(fieldname);
x:=0;
@For(n:=1;n<=@Elements(lList);n:=n+1;
x:=x+@Round(@ToNumber(lList[n])));
x
Then it worked.