Question

I want to create a view using JSON formatting. In this view I want to use a location column called "Adres" (I checked the URL and the field name really is called "Adres").

The formatting works fine with all the other columns, except when I try to add the value from the location column. In the formatting I type [$Adres], similar to the other columns, but the whole view disappears. As long as I don't use location columns the formatting works fine.

Do I have to refer to the value of a location column in a certain way other than [$Adres]?

Thanks for your help.

Was it helpful?

Solution

In order to use Location fields you need to use one of the properties it exposes in JSON formatting.

The location field object has the following properties (with example values):

{
   "Address": {
      "City": "Knoxville",
      "CountryOrRegion": "United States",
      "State": "TN",
      "Street": "963 Worlds Fair Park Dr"
   },
   "Coordinates": {
      "Latitude": "35.961673736572266",
      "Longitude": "-83.92420959472656"
   },
   "DisplayName": "World's Fair Park",
   "LocationUri": "https://www.bingapis.com/api/v6/localentities/8346bf26-6da4-104c-6ba5-2334b83f6ac8?setLang=en"
}

For Example, if you want to get the name of City then you need to use [$InternalName.Address.City] OR if you want to get the name of country or region then you will use [$InternalName.Address.CountryOrRegion].

So, make sure you are using this column in proper supported format/syntax.

Reference: Use column formatting to customize SharePoint - Special String Values

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