Forum Discussion

MannyCruz's avatar
MannyCruz
Qrew Assistant Captain
8 years ago

Formula Field Coloring Help

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?
  • Try this:

    "<div style=\"font-size: 9pt; color:black;background-color:orange; width:80px; text-align:center; \">"&"YOUR TEXT VALUE HERE"&"</div>",
    • MannyCruz's avatar
      MannyCruz
      Qrew Assistant Captain
      That is kind of where I was going with it, but the text happens to be that last line of the formula; 
      "$" & List(",",$Thousands,$Hundreds) & $Decimals)

      because it is pulling a number from the [Calculated SL Tax] field (listed above as variable 'Value') But I had to use the rest of the formula to keep the currency formatting. So basically, what do I wrap the div style with? Where do I place it so it returns the coloring? I have zero idea, and if anyone has any other way of colorizing a formula number field AND maintain formatting, im all ears
    • Eric_J_Hansen's avatar
      Eric_J_Hansen
      Qrew Cadet
      you could potentially create the formula in one field and then the formula text field to colorize the result in a separate field. thoughts?
    • MannyCruz's avatar
      MannyCruz
      Qrew Assistant Captain
      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.