Forum Discussion

Re: Change Text Color based on condition

@Mae Dahl
This should work, I've made some assumptions about the names of your fields.

If(
     [Total Items Requested] = [Total Items Fufilled], "Green",
     [Total Items Fufilled] < [Total Items Requested], "Yellow",
     ""
)





------------------------------
Justin Torrence
Quickbase Expert, Jaybird Technologies
jtorrence@jaybirdtechnologies.com
https://www.jaybirdtechnologies.com/#community-post
------------------------------

3 Replies

  • MaeDahl's avatar
    MaeDahl
    Qrew Member

    Thank you Justin,

     

    This works if I setup a separate field however I'd like to turn the actual number field listed under "Total Items Fulfilled" "Green" when the number matches the Total Items requested.

     

     

    @Mae Dahl
    This should work, I've made some assumptions about the names of your fields.

    If( [Total Items Requested] = [Total Items Fufilled], "Green", [Total Items Fufilled] < [Total Items Requested], "Yellow", "" )

     



    ------------------------------
    Justin Torrence
    Quickbase Expert, Jaybird Technologies
    jtorrence@jaybirdtechnologies.com
    https://www.jaybirdtechnologies.com/




    • JustinTorrence's avatar
      JustinTorrence
      Qrew Cadet

      Ah, I see. The numeric field doesn't have any native support for changing colors conditionally. I would recommend creating a rich text field and using HTML to display whatever value is in "Total Items Fulfilled", you can the change the CSS of the HTML element dynamically when the condition is met.

      I think this should work:

      var text color = If( [Total Items Requested] = [Total Items Fufilled], "Green", [Total Items Fufilled] < [Total Items Requested], "Yellow", "" );
      
      "<p style='color: " & $color & "'>" & [Total Items Fufilled] & "</p>"


      ------------------------------
      Justin Torrence
      Quickbase Expert, Jaybird Technologies
      jtorrence@jaybirdtechnologies.com
      https://www.jaybirdtechnologies.com/#community-post
      ------------------------------
      • MaeDahl's avatar
        MaeDahl
        Qrew Member

        Worked thanks

         

         

         

         

        Mae Dahl

         

          

        Fleet Engineering & Sustainability

        Frito-Lay HQ Plano Campus | Mae.Dahl@PepsiCo.com

         M  (972-567-4766)  | W (972-334-5943)