Forum Discussion

UrsulaLlaveria's avatar
UrsulaLlaveria
Qrew Assistant Captain
5 years ago

toFormattedText rounding and changing hard coded number in formula field

Hi All, 

I am attempting to format a numeric field in a formula-text. Using the example for toFormattedText: ToFormattedText(1234567.89,"comma_dot"), my response should be "1,234,567.89". So why is it that when I display that field on the form, it is displaying: 1,234,567.9 !?!?!?!?!  

I tried to use this formula to convert a currency field, and it is rounding it to the first decimal point. Any ideas what is going on?



------------------------------
Ursula
------------------------------

4 Replies

  • AustinK's avatar
    AustinK
    Qrew Commander
    I see the exact same thing. If I save the formula as the example shows and go back into it the number is also different. "1234567.89" becomes "1234567.9" in my formula even.

    I was able to get it to finally display 2 decimals by using a Formula Numeric field(set to 2 decimal places in the properties) and this formula ToNumber(ToFormattedText(1234567.9,"comma_dot")) but it rounds 89 up to 90. Funnily enough if you do the same function but with dot_comma instead QuickBase interprets the first dot as the first decimal place instead of the first separator and only displays 1.23 instead of the full number. So this whole function may be a little screwy depending on your app settings as well, I assume that is what is causing that in mine.
    • UrsulaLlaveria's avatar
      UrsulaLlaveria
      Qrew Assistant Captain
      That is really concerning to me. We use this often when converting numeric to text for Word document generation. If it is rounding the numbers or truncating them, then what is the point of having this as a formula?

      ------------------------------
      Ursula
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend
        I have never really got those to fully cooperate for me, so I do it the old way.  Here is one of my formulas.


        var number Value = Round([currency field],0.01);
        var text Decimals = "." & Right(ToText(Int(Abs($value) * 100)),2);
        var text Thousands = If(Abs($Value)>=1000,ToText(Int(Abs($Value)/1000)));
        var text Hundreds=Right(ToText(Int(Abs($Value))),3);

        If($Value=0,"$0.00",
        If($Value<0, "<font color=red>- ")
        &
        "$" & List(",",$Thousands,$Hundreds) & $Decimals)

        ------------------------------
        Mark Shnier (YQC)
        Quick Base Solution Provider
        Your Quick Base Coach
        http://QuickBaseCoach.com
        mark.shnier@gmail.com
        ------------------------------