Forum Discussion

MatildaB1280's avatar
MatildaB1280
Copper Contributor
Aug 01, 2024
Solved

Problems with static values in sharepoint list - possible workaround with JSON??

I have a list of changes in sharepoint , each change is an entry. I have a current week view and a next week view for the change management list. These are filtered by week number of the chnage, as if i used a range of between eg 7 - 14 days, if i were to look at the list on a friday it would miss out the changes for the following monday in my next week view. It seemingly works but at the beginning of each week it doesnt refresh unless i make a small change, save , then revert the change in list settings, or if i add a new entry. 

I went through several Microsoft community posts and they all say that calculated values (based on content of another columns) are only updated if

  • the item/list entry is created
  • the item/list entry is modified
  • the whole view or cloumn is modified

     

    I was advised I could try playing around with JSON formatting to display the content of the other columns, instead of using calculated columns, but not sure where to start/how to go about it. I will inlude screenshots of what I have in my sharepoint list 

     

     

  • Hi MatildaB1280,

    I was wondering if you could change the approach a little bit.

    If the calculated columns cannot be used for the calculation of the current week, maybe you can create a new calculated column to get the first day of the week for all items (this one doesn't need to be recalculated).

    Then, you can use this value in views like ThisWeek and NextWeek.

     

     

    ThisWeek view:

     

     

    NextWeek view:

     

     

     

    Would this be a solution for you? I have just tested it on a few items, but I hope it will work on a larger set of data. Another thing to note is the start of the week; in my case, it calculates the week starting from Sunday. 

3 Replies

  • michalkornet's avatar
    michalkornet
    Iron Contributor

    Hi MatildaB1280,

    I was wondering if you could change the approach a little bit.

    If the calculated columns cannot be used for the calculation of the current week, maybe you can create a new calculated column to get the first day of the week for all items (this one doesn't need to be recalculated).

    Then, you can use this value in views like ThisWeek and NextWeek.

     

     

    ThisWeek view:

     

     

    NextWeek view:

     

     

     

    Would this be a solution for you? I have just tested it on a few items, but I hope it will work on a larger set of data. Another thing to note is the start of the week; in my case, it calculates the week starting from Sunday. 

    • MatildaB1280's avatar
      MatildaB1280
      Copper Contributor

      michalkornet 

      Hello @michalkornet

      Thanks for your responses. I belive this worked for me as I implemented it last week, checked the view this week and the change from last week is gone as I wanted. I thereford wanted to ask you the same for the year. I filter using the year in a similar way and worried about whether it wont update, even though its only every 365 days this would pose problem. Im worried if this method will also not refresh automatically, can you tell me please? 

       

       

       

       

      • michalkornet's avatar
        michalkornet
        Iron Contributor

        Hi MatildaB1280, in this case, we can use a similar approach as in the 'week' example. The 'Change-Year' column is fine and can be used in the view filters. The easiest way would be to simply enter '2024' in the filter input for this year, like this.

         

        I also saw some examples where we can create two calculated columns: one for the start of the year from a date (to get January 1st, 2024) and another for the end of the year (to get December 31st 2024). Then, we can filter items in the view where Today is greater than the start date and less than the end date.

         

Resources