1

I need to do a databar format on a choice column with text inside. Is this possible? I can get it easily enough with the given JSON formatting code but i cannot seem edit the code below enough to where it gives me why I need. My choice are New, Approved, Scoping, and Completed.

{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "children": [ { "elmType": "span", "txtContent": "@currentField", "style": { "padding-left": "8px", "white-space": "nowrap" } } ], "attributes": { "class": "sp-field-dataBars" }, "style": { "padding": "0", "width": "=if(@currentField >= 20, '100%', (@currentField * 5) + '%')" } }

1 Answer 1

2

Would this one help you?

{ "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json", "elmType": "div", "children": [ { "elmType": "span", "txtContent": "@currentField", "style": { "padding-left": "8px", "white-space": "nowrap" } } ], "attributes": { "class": "sp-field-dataBars" }, "style": { "padding": "0", "width": "=if(@currentField == 'New', '25%', if(@currentField == 'Approved', '50%',if(@currentField == 'Scoping', '75%','100%')))", "box-sizing": "border-box" } } 
1
  • Ah, thats why all the crap i tried didnt work. I was nesting the ifs differently. I spent way too long on this last night. thank you. Commented Oct 29, 2019 at 14:11

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.