Question

I got a list where i use the PromotedState column to display if a site is a sitepage or a newspage based on the number "0" and "2" (0=sitepage, 2=newspage).

The column is populated with these values (0 or 2) now u want to create a new column called Type page that look up the PromotedState value and display the text Sitepage or Newspage based on the populated value.

Was it helpful?

Solution

You can do this with Column Formatting directly on the PromotedState column using this format:

{
  "elmType": "span",
  "txtContent": "=if(@currentField == 0, 'Sitepage', if(@currentField == 2, 'Newspage', ''))"
}

The double check is there to account for folders.

You can apply this format by adding the Promoted State column to your view and choosing Format this Column in the column menu. Then just paste the above and hit Apply.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top