Getting rid of decimals
AnsweredHi. I have a calculation field where I sum up the total amount of supplies. I'd like this as a whole number without zeroes, can I get that with Javascript in anyway?
-
Lee,
The option should be there for you, I can't attach a screen shot so here is an imgur link. http://imgur.com/bnM2f9c
Hope that helps!
Matt
-
Hi Lee,
as I've written in my first post the option to set decimals is only available in calculation fields which are number type. Your calculation field seems to be text type (cause you have a text string as result of your input). Which kind of type a calculation field is, will be defined automatically depending on what's in the calculation field when you save it clicking "done" in the template creator. The type can't be changed once it is defined.
If you would like to have a calculation field as number type in your app you have to delete your existing calculation field and to create a new one with a code that results in a pure number. To make sure that a calculation field is number type you can only put in e.g. a relation to a number field (type: @your_number_field), then save the template, open it again and type in your wished calculation. If the result of your wished calculation code is a string you'll get an error notification - and then you have to change the code. If you need help to change your code, show it here, maybe I can give you a tip.
Good luck.
Rainer -
Hi Rainer and sorry to highjack your thread felix.
Thanks for clearing up the way the calculation field works, I've now set to them numeric but this has kind of lead me onto another problem.
I'm using zapier to pull the data from podio into another web app called webmerge which will automatically create my quotations for my customers.
Although setting the field in Podio to only 2 decimal places will show this value in 'podio'. See here http://imgur.com/tbptF0y
When I pull the data over into Zapier it adds on the extra decimal places again See here:- http://imgur.com/7gxlLFT
and then finally where the data is meant to end up in my quotation template it's done it again. See here:- http://imgur.com/GCuhkPs
That's why I was thinking that maybe I need to use some kind of javascript to do the rounding in the calculation field but have no idea where to start as I can't code (yet).
I've tried using .toFixed(2) and I think this is what mucked it up last time...
Any ideas?
Lee
-
Hi Lee,
the setting options only define how the number is displayed in the Podio item. But the original value with 4 decimal places wouldn't be manipulated by the settings. I don't use Zapier so I don't know which format will be transferred from Podio to Zapier.
Maybe it works with:
Number((@Price Ex VAT)/100*5).toFixed(2)
-
@Rainer - I could use your help with a rounding issue. I read this entire thread and your input about how the Calculation field determines if the field is a number or text field was VERY helpful and confirmed what I thought I was seeing, but was not certain. For that - thank you!
...however, the problem is that I have a rather lengthy set of calculations that take % of various other items, does a few more calculations, etc. Needless to say when the final calculation is made, the total is off by a 1 cent! I figure I need to round some of these numbers to get back to a pure 2 decimal placed number (not 4 places). I have used the .toFixed(2) method.. and after much trial and error found that the field had converted to text.. which you confirmed here.. ugh!
How can I round various fields to 2 decimal places AND STILL keep them as numbers (not text) that can be used in further calculations?? I would be most grateful for your help. Thank you.
Please sign in to leave a comment.
Comments
14 comments