Forum Discussion
JSON Formatting
I created a JSON that counts the days after a certain start date "A" and stops after a date "B" if there is no date in B it keeps counting. Further the days count<90 turn green, 90-120, turn yellow, >120 turn red. The problem I encounter is that it works fine in 0. All items, but no longer in a specific view, although the record gives the correct number (B-A) the visual view keeps counting from A.
Did anyone had something similar?
The JSON code checked out correct and it was mentioned that the error is to be found in SharePoint backend configuration settings, rather than frontend browser code or indexing times.
What could/should be changed in the backend configuration to solve this?
1 Reply
- Emily2002Iron Contributor
Check whether date B is included in the affected view. SharePoint column-formatting JSON can reference another column, but that column needs to be available in the same view.
Your symptoms fit this: All items includes B, so the calculation stops correctly. The other view may omit B, causing the formatting to treat it as empty and keep counting from A—even though the saved record is correct.
Open the affected view’s Show/hide columns or Edit current view, add both A and B, save, and reload the page. Make sure any other columns referenced by the JSON are included too.
Also check that the JSON references the columns’ internal names, which may differ from their display names.
I wouldn’t change backend configuration or rebuild an index based on this alone. If adding B doesn’t fix it, share the JSON and the column selections for both views; that comparison is the next useful step.