Getting Started

 View Only
  • 1.  Color-coding a field returns field name

    Posted 05-24-2022 12:27
    I have a purchase date field and a second field that is calculating the age based on Today's date.  In a third field I have a rich text field that I'm trying to color-code red if the age is greater than 3 years.  If not, I want to just return the age.  I'm able to return the age but the color is only returning the field name, not the actual value.

    Here is the Age Formula:
    var date DOB = [Purchase Date];

    var number Years =

    (Month(Today())=Month($DOB) and Day(Today())<Day($DOB)),1,0);

    var number MonthsDifference = Month(Today()) - Month($DOB) ;
    var number Months = If($MonthsDifference >= 0, $MonthsDifference, 12 + $MonthsDifference);

    Round($Years + $Months/12,0.1)

    Here is the formula to apply the color:
    If([Age Formula]>3,"<div style=\"background-color:red;\">[Age Formula]</div>",ToText([Age Formula]))

    Here is the report example:

    David Semitekol

  • 2.  RE: Color-coding a field returns field name
    Best Answer

    Posted 05-24-2022 14:36
    Use below formula to apply color :

    If([Age Formula]>3,"<div style=\"background-color:red;\">"&[Age Formula]&"</div>",ToText([Age Formula]))

    Pranav Choudhary
    Quickbase Expert Builder Certified by Quickbase

  • 3.  RE: Color-coding a field returns field name

    Posted 05-24-2022 14:39
    Thanks, adding the "& [Field] &" worked perfectly.

    David Semitekol