Why does the JSON script not work?

Lopez, Ahiezer 236 Reputation points
2023-01-18T16:36:21.24+00:00

I am looking to use a JSON script to set a column equal to a calculated JSON script. However, the column itself is blank so I tried using a simpler JSON script. I formatted the distance column with the following JSON script. Both distance and TempInfo are text data types. What am I doing wrong?

{  
  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",  
  "elmType": "div",  
  "txtContent": "=[$TempInfo]"   
}

Column with JSON Script:

User's image

TempInfo Column:

User's image

Result:

User's image

Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

Answer accepted by question author
  1. Emily Du-MSFT 51,941 Reputation points Microsoft External Staff
    2023-01-19T02:25:02.99+00:00

    Select distance column -> Column settings -> Format this column -> Advanced mode -> Add following codes.

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
      "elmType": "div",
      "txtContent": "=[$TempInfo]"
    }
    

    You should use [$ColumnName] to reference another column, the ColumnName need to be the internal name instead of the display name. To check the internal name of the column, you could check it in the URL.

    User's image


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.