Forum Discussion

MattHardy1's avatar
MattHardy1
Qrew Trainee
4 years ago

Losing Number Format in Rich Text Formula

I found a few references to my issue in old posts but the links all seem to be dead.

I'm trying to display the value of a currency field [PO Subtotal] in a rich text formula field. The number displays but drops the number formatting I have setup on the [PO Subtotal] field, leaving me with either 1 or no decimal points depending on the situation. How can I force two decimal points in a rich text formula field? [PO Subtotal] displays with 2 decimal points outside this rich text field.

I feel like I'm missing something simple but after checking the display options for every field involved in this, I'm out of ideas and above all frustrated when all the (seemingly) relevant QB Community links are broken.

Below is the entire code from the rich text formula field.

"
<table align=\"right\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" style=\"width:820px;\">
  <tbody>
    <tr>
      <td style=\"width: 70%;\">&nbsp;&nbsp;</td>
      <td style=\"text-align: right;\">
        <p>Subtotal</p>
        <p>HST (13%)</p>
        <p>Invoice Total</p>
        <p>Total Payments</p>
		<p>Balance Due</p></td>
      <td>
        <p style=\"text-align: right;\">" & [PO Subtotal] & "</p>
        <p style=\"text-align: right;\">" & [Tax] & "</p>
        <p style=\"text-align: right;\">" & [Total] & "</p>
        <p style=\"text-align: right;\">" & [Total Payments] & "</p>
        <p style=\"text-align: right;\">" & [Balance] & "</p>
      </td>
    </tr>
  </tbody>
</table>
"​


------------------------------
Matt Hardy
------------------------------

3 Replies

  • Here is a formula that probably works to convert the number to a text string with decimals.

    var text txtRounded = ToFormattedText(Round([yourvalue]*100,0.01),"none_dot");
    var number wheredot=If(Contains($txtRounded,"."),Length(Right($txtRounded,".")),0);
    var text fmtnbr = If($wheredot = 0, $txtRounded & ".00", If($wheredot = 1, $txtRounded & "0", $txtRounded)) ;

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • MattHardy1's avatar
      MattHardy1
      Qrew Trainee
      With some slight modification, that worked perfect. Thank you so much for the quick reply Mark.

      Here's the mod I made:
      var text txtRounded = ToFormattedText(Round([yourvalue],0.01),"comma_dot");

      ------------------------------
      Matt Hardy
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Qrew Champion
        Ok great, ya that must have been one to use for Percentages.

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