# ToText formula output broken for some numbers

**URL:** <https://community.fibery.io/t/totext-formula-output-broken-for-some-numbers/2549>\
**Category:** Bugs & Issues\
**Created:** [February 14, 2022, 3:56pm UTC](https://community.fibery.io/t/totext-formula-output-broken-for-some-numbers/2549 "2022-02-14T15:56:47Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![rothnic](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/rothnic/32/1850_2.png) [@rothnic](https://community.fibery.io/u/rothnic)\
**Post date:** [February 14, 2022, 3:56pm UTC](https://community.fibery.io/t/totext-formula-output-broken-for-some-numbers/2549/1 "2022-02-14T15:56:47Z")

</div>

I was importing some data that seemed to require me to use the Decimal number field to avoid having issues importing it. I was making use of that number to create a list of ids, so I needed it as text and ran into issues. Some of the number worked fine, but others came out of the function looking like they were unable to be converted to text. It seems like the length of the number had something to do with it.

The field I’m converting to text is a number field configured to have a single decimal point. When I pass that through ToText, I get the following.

Correct: `ToText(256292011) = 256292011.0`  
Incorrect: `ToText(21393064011) = ##########.##########`

---

<div class="post-metadata">

**Author:** ![rothnic](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/rothnic/32/1850_2.png) [@rothnic](https://community.fibery.io/u/rothnic)\
**Post date:** [February 17, 2022, 2:35pm UTC](https://community.fibery.io/t/totext-formula-output-broken-for-some-numbers/2549/2 "2022-02-17T14:35:30Z")

</div>

Wanted to bump this one. Is there a workaround for this? I tried different formulas to avoid the issue, but it seems the only option would be to manually copy the decimal value into an integer.

---

<div class="post-metadata">

**Author:** ![rothnic](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/rothnic/32/1850_2.png) [@rothnic](https://community.fibery.io/u/rothnic)\
**Post date:** [February 28, 2022, 10:37pm UTC](https://community.fibery.io/t/totext-formula-output-broken-for-some-numbers/2549/3 "2022-02-28T22:37:38Z")

</div>

Bumping this issue again. Rounding the number didn’t help and there is no formula to convert a decimal number to an integer.

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [March 1, 2022, 7:24am UTC](https://community.fibery.io/t/totext-formula-output-broken-for-some-numbers/2549/4 "2022-03-01T07:24:06Z")

</div>

Have you tried created a new number formula field which merely points to the decimal field, but with the number of decimal places set to zero

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/8/85c73bb4efae337c9b61f412c237860d1c1d6f2e.png)  
and then use this field in your totext() wherever you need it.

It’s hacky, but has worked for me in the past.

---

<div class="post-metadata">

**Author:** ![rothnic](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/rothnic/32/1850_2.png) [@rothnic](https://community.fibery.io/u/rothnic)\
**Post date:** [March 1, 2022, 4:01pm UTC](https://community.fibery.io/t/totext-formula-output-broken-for-some-numbers/2549/5 "2022-03-01T16:01:32Z")

</div>

Thanks for looking into this. At first I was thinking I overlooked doing this, but when looking at the schema again I seem to have tried it. I have this long-ish id as a decimal, then have tried converting it to an int and to text via a formula. The integer ends up being empty and the text formula ends up with the same issue with the XXX’s.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/a/ab64e5973bf84c92c75e878b92c88ec0c4743b1c.png)

![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/f/fdb994571e21dda773f5408c9f7a4ce72f54dab4.png)

@Polina_Zenevich contacted me through chat about the error, since I guess it drove lots of error messages or something. However, the suggestion was that there is a way to convert decimal to integer, but I’m not able to find a way to do that. I understand resources are strained right now, so I will try to find another workaround.

---

<div class="post-metadata">

**Author:** ![antoniokov](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/antoniokov/32/201_2.png) [@antoniokov](https://community.fibery.io/u/antoniokov)\
**Post date:** [March 1, 2022, 4:25pm UTC](https://community.fibery.io/t/totext-formula-output-broken-for-some-numbers/2549/6 "2022-03-01T16:25:00Z")

</div>

We are looking into the `ToText` weirdness.

Meanwhile: how do you use the original Decimal Field?  
If it’s just a temporary “storage”, you could migrate the data using copy-paste on a Table View instead of a Text Formula Field.

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [March 1, 2022, 4:38pm UTC](https://community.fibery.io/t/totext-formula-output-broken-for-some-numbers/2549/7 "2022-03-01T16:38:59Z")

</div>

Here’s an ugly hack:

```auto
Replace(Left(ToText((Decimal + 0.5) / 1000),Length(ToText((Decimal + 0.5) / 1000)) - 1),".","")

```

It works as long as the original Decimal number is an integer.  
It will allow you to convert numbers up to 9,999,999,999,999  
A side-effect is that any numbers less than 1000 will get leading zeroes.

If there are limitations on the possible values of Decimal (e.g. always a certain length) then there would be some simplifications possible.

---

<div class="post-metadata">

**Author:** ![Andray\_Shotkin](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/andray_shotkin/32/1531_2.png) [@Andray\_Shotkin](https://community.fibery.io/u/Andray_Shotkin)\
**Post date:** [March 1, 2022, 5:36pm UTC](https://community.fibery.io/t/totext-formula-output-broken-for-some-numbers/2549/8 "2022-03-01T17:36:39Z")

</div>

@rothnic i am sorry for inconvenience 🙏

It is a bug with the number of decimal positions before the dot.  
By default 10 decimal positions before the dot were supported and 21393064011 having 11 decimal positions before the dot fails to convert to text.  
Fix allowing 15 decimal positions before the dot will be deployed this week.

P.S. i believe that @Chr1sG guides some hacker special forces because of producing unbelievable workarounds!

---

<div class="post-metadata">

**Author:** ![rothnic](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/rothnic/32/1850_2.png) [@rothnic](https://community.fibery.io/u/rothnic)\
**Post date:** [March 1, 2022, 6:05pm UTC](https://community.fibery.io/t/totext-formula-output-broken-for-some-numbers/2549/9 "2022-03-01T18:05:57Z")

</div>

> [@Chr1sG](#):
>
> `Replace(Left(ToText((Decimal + 0.5) / 1000),Length(ToText((Decimal + 0.5) / 1000)) - 1),".","")`

Nice, I tried a regex replace at one point, but I didn’t think about pushing more of the data into the decimal end of the number. This seems to have fixed the issue for me temporarily. Thanks a bunch!
