Column formatting is a nice way to customize your modern lists views. But it requires that the columns used in the JSON are referenced in the view.

In this workaround you need a calculated column present in the view. It doesn’t need to be the column you are formating.

For this  example, create a column ‘Flow Status’ and a column ‘Color’. The purpose is to show the color in the column status.

Go to the formating panel of column Flow Status

and paste the folowing JSON

If the column color is present in the view, the formating is correct

But, if you hide the column, it not shows the color correctly

So the trick is to make a reference to the Color column without showing it in the view. To do that, the easiest way is to make that reference in the calculated field with a condition that never happens.

The column Flow Status calculated field has a simple formula

what we need to include is a condition that never happens. For example, put in the formula the condition if 1 equal to 2 then show Color else, show Flow status.

IF(1=2;color;_Hidden_FlowStatus)

This way, the view have reference to the column color and show the format correctly


7 Comments

Erwin Koens · October 22, 2019 at 8:43 am

Hi. Cannot get this working. What is the name of the calculated column? Is the calculated column displayed?

Wim · November 7, 2019 at 8:42 am

Hi, Can’t get this working. Only works when you load loading the calculated view from a view where all required columns are present. Loading the trimmed view with only calculated column after hard refresh does not give the values from the referenced columns.

    Valter Lima · November 7, 2019 at 10:46 am

    Hi,
    You need to put the required columns in some of the calculated field.
    In my example, the required field is Color, and i put it in a calculated field in a condition that never happens:

    =If(1=2;Color; _Hidden_FlowStatus)

    did it helps? If not, please post your example whit the required and calculated fields.

Joseph · December 5, 2019 at 10:06 pm

I also could not get this solution to work. The workaround I ended up using was not hiding the columns I didn’t want to show, but instead using JSON formatting of those columns to make them appear blank.

    Valter Lima · December 6, 2019 at 11:59 am

    Its a way of getting things done, but did you try to put that collumn in a calculated field? That way you have the needed reference to the collumn and if you put it in a condicion that never happens it doesn´t appear in the view, for example 1 = 2. then you use this calculate field to show a collumn that you already need to show in the view.

[Tips & Tricks] View-Formatting With a Column not present in the view – DevScope Ninjas · February 21, 2020 at 4:07 pm

[…] workaround used in this post is the same used in the Column-Formatting With a Column not present in the view, but with a different example that can be more easily […]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.