Forum Discussion

carlblunck's avatar
carlblunck
Copper Contributor
Aug 19, 2022
Solved

Conditional formatting help

Hi community,   Just need some help with some JSON conditional formatting code.  Snip of my list, note the current result values are blank because of the JSON code issue. Current JSON script...
  • RobElliott's avatar
    Aug 19, 2022

    carlblunck you've missed out the second = 

     

    It should be =='Under' etc

     

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
      "elmType": "div",
      "txtContent": "@currentField",
      "style": {
        "color": "=if((@currentField > [$Benchmark] && [$Goal]) == 'Under', 'red', if((@currentField < [$Benchmark] && [$Goal]) == 'Over', 'red', 'green')",
    	"font-weight": "=if((@currentField > [$Benchmark] && [$Goal]) == 'Under', 'bold', if((@currentField < [$Benchmark] && [$Goal]) == 'Over', 'bold', 'normal')"
      }
    }

     

    Rob
    Los Gallardos
    Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)

Resources