Discussions

 View Only
  • 1.  Numeric Formula font color change

    Posted 07-13-2017 03:46
    I have a Numeric Formula. It is a simple subtraction field.
    [Total Points 2015-16]-[Total Points 2016-2017] 
    I would like to have it turn green when positive, and red when negative. 
    I understand you can not do any conditional formatting in a Numeric Formula field. 
    I understand you need to use a TextFormal Field. 
    I have tried different things i have seen in other post, but i simply can not get it to work at all. 
    What formula can i use to make this happen?


  • 2.  RE: Numeric Formula font color change

    Posted 07-13-2017 04:19
    Try this

    // enter your field name here:
    var number Rounded = Round([My Points Subtraction field]);

    var text MyNumberInText = ToText($Rounded); 


    var text ColorCode =
    If(
    $Rounded < 0,"pink", "green");


    Case($ColorCode,
    "pink","<div style=\"background-color: pink;\"" & ">" &  $MyNumberInText  & "</div>",

    "green","<div style=\"background-color: #00C957;\"" & ">" &  $MyNumberInText & "</div>")


  • 3.  RE: Numeric Formula font color change

    Posted 07-13-2017 09:37
    var number points = [Total Points 2015-16]-[Total Points 2016-2017];

    If( $points >= 0 , "<span style=\"color:#008000; font-weight:bold\">"&$points&"</span>", "<span style=\"color:#ff0000; font-weight:bold\">"&$points&"</span>"  )

    I hope this will solve the issue !!!


  • 4.  RE: Numeric Formula font color change

    Posted 07-13-2017 17:39
    Thanks! Both worked.