0

I am trying to display different text in a multiline text field depending on the value in a separate single line text field. I can get the if statement to work with one condition but if I try to nest if conditions then the column outputs the JSON.

Here's my code:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "=if([$PersonaTitle] == 'Developer', 'dev-test', 'test'), if([$PersonaTitle] == 'Manager','Manager test','not test'))"
}

One condition:

enter image description here

Nested conditions

enter image description here

1 Answer 1

0

The following should work

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "=if([$PersonaTitle] == 'Developer', 'dev-test', if([$PersonaTitle] == 'Manager','Manager test','not test'))"
}

enter image description here

1
  • I see, I was adding an optional text for each condition but there can only be one. Commented Oct 29, 2024 at 20:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.