# Having difficulty showing two decimal places in text formulas. Bug?

**URL:** <https://community.weweb.io/t/having-difficulty-showing-two-decimal-places-in-text-formulas-bug/4375>\
**Category:** Ask us anything\
**Created:** [September 15, 2023, 9:34pm UTC](https://community.weweb.io/t/having-difficulty-showing-two-decimal-places-in-text-formulas-bug/4375 "2023-09-15T21:34:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericp](https://avatars.discourse-cdn.com/v4/letter/e/ea666f/32.png) [@ericp](https://community.weweb.io/u/ericp)\
**Post date:** [September 15, 2023, 9:34pm UTC](https://community.weweb.io/t/having-difficulty-showing-two-decimal-places-in-text-formulas-bug/4375/1 "2023-09-15T21:34:01Z")

</div>

I have a decimal field in Xano that I’m using in a text formula. If the value in Xano does not have a hundredths value, the text formula is not showing those trailing zeros, even when using a rounding function to 2 decimal places. Is this a bug?

FWIW, if I try to trick it by adding 0.001 to the Xano value (eg. round(20.5+0.001)), it still won’t show the last zero. But if I add 0.005, it will show 20.51.  
 ![Screenshot 2023-09-15 163153](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/f/fd46e2823eff899662dd25658b414f79ef0641b1.jpeg)  
 ![Screenshot 2023-09-15 163259](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/6/61cce5261511480a06397ba96990fd3dab677d81.jpeg)

---

<div class="post-metadata">

**Author:** ![ericp](https://avatars.discourse-cdn.com/v4/letter/e/ea666f/32.png) [@ericp](https://community.weweb.io/u/ericp)\
**Post date:** [September 15, 2023, 9:37pm UTC](https://community.weweb.io/t/having-difficulty-showing-two-decimal-places-in-text-formulas-bug/4375/2 "2023-09-15T21:37:14Z")

</div>

I should clarify, this behavior occurs with a Xano value with no tenths value too.

---

<div class="post-metadata">

**Author:** ![Joyce](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/joyce/32/13232_2.png) [@Joyce](https://community.weweb.io/u/Joyce)\
**Post date:** [September 19, 2023, 10:47pm UTC](https://community.weweb.io/t/having-difficulty-showing-two-decimal-places-in-text-formulas-bug/4375/3 "2023-09-19T22:47:58Z")

</div>

Hi @ericp 👋

I’m struggling to understand what’s working and what isn’t.

Can you tell me the results you have for different values in Xano?

For example:

- 420.5 in Xano =\> displays 420.5 correctly in WeWeb
- 420.56 in Xano =\> displays x in WeWeb but I want to display 420.6
- 420.001 in Xano =\> displays x in WeWeb
- 420 in Xano =\> displays x

It’ll help me reproduce your use case on my side and hopefully find a solution for you 🙂

---

<div class="post-metadata">

**Author:** ![ericp](https://avatars.discourse-cdn.com/v4/letter/e/ea666f/32.png) [@ericp](https://community.weweb.io/u/ericp)\
**Post date:** [September 19, 2023, 11:09pm UTC](https://community.weweb.io/t/having-difficulty-showing-two-decimal-places-in-text-formulas-bug/4375/4 "2023-09-19T23:09:11Z")

</div>

Hi Joyce,

I’m trying to get a Xano value of 20.5 to display as 20.50 in WeWeb inside of a text field that provides context to what the currency value is related to. Thought using the rounding function with 2 decimal places would do the trick, but it does not.

Eric

---

<div class="post-metadata">

**Author:** ![Joyce](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/joyce/32/13232_2.png) [@Joyce](https://community.weweb.io/u/Joyce)\
**Post date:** [September 19, 2023, 11:32pm UTC](https://community.weweb.io/t/having-difficulty-showing-two-decimal-places-in-text-formulas-bug/4375/5 "2023-09-19T23:32:28Z")

</div>

Aaaah ok, got it! I was tying knots in my brain 😅

Mmm it looks like something we could improve on our side. I’ll share with the team.

In the meantime, something like this should work:

 ![CleanShot 2023-09-20 at 01.28.40@2x](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/4/4a1248badc4978302033966699dcfb09ab6ec319.png)

Here’s the Javascript equivalent if you prefer that approach:

`return (Math.round(number * 100) / 100).toFixed(2)`

 ![CleanShot 2023-09-20 at 01.25.31@2x](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/5/59cd350c477fd11605e686075604cecfb8268635.png)

Just make sure you replace the `number` parameter by whatever variable or item data you are getting your number from.

So for example in my project, I’m using the custom formula I created in no-code above and binding it to my item data coming from a Xano collection:

 ![CleanShot 2023-09-20 at 01.30.41@2x](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/a/a8f6f4188d3a3ca6442d943311f3c458594f7cfe.png)

---

<div class="post-metadata">

**Author:** ![ericp](https://avatars.discourse-cdn.com/v4/letter/e/ea666f/32.png) [@ericp](https://community.weweb.io/u/ericp)\
**Post date:** [September 20, 2023, 2:09am UTC](https://community.weweb.io/t/having-difficulty-showing-two-decimal-places-in-text-formulas-bug/4375/6 "2023-09-20T02:09:52Z")

</div>

Thank you once again Joyce, the no-code formula works for me.
