Formula Field Coloring Help

  • 1
  • 1
  • Question
  • Updated 2 years ago
  • Answered
Hey, guys, I have an issue trying to color the font and change the font size in a formula text field (which I made to be able to use HTML for a formula numeric field).

The issue is that the number is formatted as currency, so I am trying to pull that through into the formula text field, and I managed that, but now I can't figure out where to place the color tags.

Here is the formula. 
var number Value = Round([Calculated SL Tax],0.01);

var text Decimals = "." & Right(ToText(Int($Value * 100)),2);

var text Thousands = If($Value>=1000,ToText(Int($Value/1000)));

var text Hundreds=Right(ToText(Int($Value)),3);

If($Value=0,"$0.00",

If($Value<0, "- ")

&

"$" & List(",",$Thousands,$Hundreds) & $Decimals)

This works in returning the calculated number with the proper currency formatting, but now how do I go about changing the color and size of the font?
Photo of Manny De La Cruz

Manny De La Cruz

  • 940 Points 500 badge 2x thumb

Posted 2 years ago

  • 1
  • 1
Try this:

"<div style=\"font-size: 9pt; color:black;background-color:orange; width:80px; text-align:center; \">"&"YOUR TEXT VALUE HERE"&"</div>",
Photo of Manny De La Cruz

Manny De La Cruz

  • 940 Points 500 badge 2x thumb
If I follow you, you're saying to create a third field that would pull from this field and wrap that in the div style to get the coloration? If so, I think that might just work. 
yea, thats what I am thinking. It might be the fastest way to your solution.
the formula would look like this though:

"<div style=\"font-size: 9pt; color:black;background-color:orange; width:80px; text-align:center; \">"&[YOUR FORMULA FIELD HERE]&"</div>",
Photo of Manny De La Cruz

Manny De La Cruz

  • 940 Points 500 badge 2x thumb
Eric, you are a genius my friend, thank you! It's perfect
you're welcome! any time.