# Need advice about decimal

**URL:** <https://community.glideapps.com/t/need-advice-about-decimal/57805>\
**Category:** Ask for Help\
**Created:** [February 11, 2023, 6:56pm UTC](https://community.glideapps.com/t/need-advice-about-decimal/57805 "2023-02-11T18:56:13Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![rezmeplx](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/rezmeplx/32/53827_2.png) [@rezmeplx](https://community.glideapps.com/u/rezmeplx)\
**Post date:** [February 11, 2023, 6:56pm UTC](https://community.glideapps.com/t/need-advice-about-decimal/57805/1 "2023-02-11T18:56:13Z")

</div>

Hi  
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!

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [February 11, 2023, 7:27pm UTC](https://community.glideapps.com/t/need-advice-about-decimal/57805/2 "2023-02-11T19:27:22Z")

</div>

This in a javascript column should work.

```auto
return parseFloat(p1);

```

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/7/87de89e25492c89d6a3475d3b77451b9973bd433.png)

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [February 11, 2023, 9:07pm UTC](https://community.glideapps.com/t/need-advice-about-decimal/57805/3 "2023-02-11T21:07:35Z")

</div>

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)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/2/a26c48aa28af1ddcb08db21a2b9c046f268f0b4e.png)

---

<div class="post-metadata">

**Author:** ![rezmeplx](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/rezmeplx/32/53827_2.png) [@rezmeplx](https://community.glideapps.com/u/rezmeplx)\
**Post date:** [February 12, 2023, 12:50pm UTC](https://community.glideapps.com/t/need-advice-about-decimal/57805/4 "2023-02-12T12:50:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rezmeplx](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/rezmeplx/32/53827_2.png) [@rezmeplx](https://community.glideapps.com/u/rezmeplx)\
**Post date:** [February 12, 2023, 1:10pm UTC](https://community.glideapps.com/t/need-advice-about-decimal/57805/5 "2023-02-12T13:10:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [February 12, 2023, 2:15pm UTC](https://community.glideapps.com/t/need-advice-about-decimal/57805/6 "2023-02-12T14:15:39Z")

</div>

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…

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/b/2be02caafcd16904ac7e9d4ccd2af6ef5c1d588f.png)

…but not as a replacement:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/7/273bb26840602f63d5ee9d9c2bd2242718fc500a.png)

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

---

<div class="post-metadata">

**Author:** ![rezmeplx](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/rezmeplx/32/53827_2.png) [@rezmeplx](https://community.glideapps.com/u/rezmeplx)\
**Post date:** [February 12, 2023, 2:17pm UTC](https://community.glideapps.com/t/need-advice-about-decimal/57805/7 "2023-02-12T14:17:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [February 12, 2023, 2:19pm UTC](https://community.glideapps.com/t/need-advice-about-decimal/57805/8 "2023-02-12T14:19:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [February 13, 2023, 2:19pm UTC](https://community.glideapps.com/t/need-advice-about-decimal/57805/9 "2023-02-13T14:19:02Z")

</div>

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