Forum Discussion
parham_6
Feb 09, 2023Copper Contributor
Use hidden column value in another column without unhiding
Hello, I have a list with a hidden column. I would like to use the value of the hidden column in another column but it does not work. I should make the column visible to use its value. Is there a wa...
SvenSieverding
Feb 10, 2023Bronze Contributor
Hi parham_6 ,
you mean using SharePoint List formatting? Then no... All columns you want to acccess from the JSON sheet must be included in the view.
You can kind of get arround that if you create a calculated column that contains the information from multiple columns. Then you can "parse" the value in your stylesheet.
So i.e. with a calulated column that concatenates the fields "Status" and "Value" using a "-"
=[Status]&"-"&[Value]
you can use this sheet
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"txtContent": "=substring(@currentField.displayValue,indexOf(@currentField.displayValue,'-')+1,indexOf(@currentField.displayValue + '^', '^'))",
"style": {
"background-color": "=if(substring(@currentField.displayValue,0,indexOf(@currentField.displayValue,'-')) == 'Committed','#FFA07A', '' )"
}
}
to display the value but have the background color of the column formatted differently if the status is "Commited".
The formulas in the JSON Sheet might become very complicated for much more that 2 parameters, though.
Best Regards,
Sven