Forum Discussion

288088's avatar
288088
Brass Contributor
Nov 05, 2019
Solved

Need help with formating colors based on time in columns

Hello!   Need some help with formating columns based on what time they got, if its more or less, then I want it to change color. See pictures.   Sorry for my bad english, hope you guys can help m...
  • 288088's avatar
    288088
    Nov 08, 2019

    Matti Paukkonen 

     

    I managed with another code to get the result that I wanted, but thanks for the effort!

     

    {
      "$schema": "<a href="https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json" target="_blank">https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json</a>",
      "elmType": "div",
      "attributes": {
        "class": "=if(@currentField <= '02:00:00', 'sp-field-severity--good', if(@currentField >= '02:00:00', 'sp-field-severity--blocked', '"
      },
      "children": [
        {
          "elmType": "span",
          "style": {
            "display": "inline-block",
            "padding": "0 4px"
          },
          "attributes": {
            "iconName": "=if(@currentField <= '02:00:00', 'CheckMark', if(@currentField >= '02:00:00', 'Warning', '"
          }
        },
        {
          "elmType": "span",
          "txtContent": "@currentField"
        }
      ]
    }