Need advice about decimal

I am building some kind of portfolio tracker for investment. For easier explanation, let’s say it’s for crypto currencies

I have a table where there are list of coins with some details such as current price and average price in another columns.
So there are prices everywhere on my frontend.
The problem here is some coins do not need lots of decimal (e.g. 104.24) whereas prices of some coins are like 0.0609121.

So when I display those prices, for some coins it will look like 104.240000, 1405.000000, just because there are coins like 0.0223422.

How can I solve this issue? so that it would look like 104.24, 1405.0, 0.0223422.

Thank you!

This in a javascript column should work.

return parseFloat(p1);


You can also place the value in an if then else column. Only caveat is that null values need to have some sort of string value (even a space will work)


what a simple way to do it. Haven’t tested yet but Thank you!

1 Like

it works too, Thank you! but why? I can’t understand why it works like this

The ITE columns attempts to return a value of the same type as the inputs. When all the types match, it outputs a value of that same type. When the types don’t match (in your case. A number with a fixed decimal place and a string value) it outputs a string.

Now that I’m thinking about it, a template column works the same way if you specify the number column as the input…

…but not as a replacement:

It’s a nuance that I learned about years ago, but leverage all the time in my apps.


I actually think this method is better than using Java because it seems faster.
Thank you!

No code for the win. In both cases, the output is treated as a string.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.