I use sharepoint 2010. I created a field called REMAINING DAYS, to compare it with the DATE OF EXPIRATION field with TODAY'S DATE.

I used this tip: Tip

The problem is that the calculation is not dynamic. To update the count of the REMAINING DAYS field I have to update all the items in the list so that the calculation is redone.

1) How can I have the REMAINING DAYS being calculated automatically daily?

2) An alternative if it is possible is to create a button on the list page that calls a javascript code that updates the items in the list (perhaps a column named "flag" 1 or 0) only for recalculation. every time you press the button it updates the items to 0 or 1. So the recalculation would be done.

3) Or with each entry in the list page, the recalculation was done with the update of the flag column (1 or 0).

4) Or via Workflows? Or Powershell?


Common solutions:

  1. Add JavaScript to the View page(s) to add the calculated value. This works well in SP 2010, but these solutions do not migrate well to newer versions. There are a number of blog articles on how to do this. This will not work with Data Sheet views.

  2. If the list is relatively small, write a SPD workflow that triggers on item creation and sleeps for 24 hours, updates the column, and the sleeps for 24 hours.

  3. If you are the SharePoint Server admin, this would be an easy project using PowerShell running as a scheduled job.

The choice depends on your role (server admin), skills (JavaScript, WF, PowerShell) and how long the content will stay in SharePoint 2010.

| improve this answer | |
  • I need the values to be written to the list. because I use it for KPI monitoring. Could you help me with the best way to do it? I am a level intermediate user. To implement a new workflow I am not aware, but I have access to the server administrator so he can execute the necessary code. – Jarbas Martinho May 3 '19 at 11:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.