Forum Discussion

MaeDahl's avatar
MaeDahl
Qrew Member
4 years ago

Change Text Color based on condition

I have a report that reflects  Total Items Requested;   Total Confirmed Ordered;   and Total Fulfilled(shipped).

IF Requested = Fulfilled I'd like the value to show Green
IF Fulfilled < Requested then show value in Yellow

Appreciate the guidance.

Mae Dahl



------------------------------
Mae Dahl
------------------------------
  • @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
    ------------------------------
    • 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
        ------------------------------