Calculated SharePoint Column

不打扰是莪最后的温柔 提交于 2020-01-16 18:44:40

问题


I have a simple calculated column in my SharePoint 2010 list. It takes the list item ID, adds 100 to it.

When my users are creating items in the list, the calculated column does not get updated unless I go in, edit the column (do nothing) and save it. It, in fact, gives all items a value of 101 unless I manually edit the column.

Is this typical or is there a work around for this issue?

Thank you!


回答1:


It is not possible to create calculated column based on ID value. The Id of the item is created after the item is added to the list.

You should use workflow instead.




回答2:


The problem with using a workflow to do this (as per the accepted answer) is that workflow can take an appreciable time to execute. So you cannot create the ID until AFTER the new item is saved and there is always the danger that simultaneous users can create ID clashes that you also have to handle. If the workflow (as on a busy system) takes several minutes to work, you can also get the problem of someone else editing the item before the workflow has finished which may cause the workflow to fail leaving the item without any ID.

As an alternative, you might consider using JavaScript in the NewItem.aspx page to lookup and increment a counter from a separate list. Note that you have to update the counter as you read it if you are doing this so as to ensure that other users don't accidentally get the same ID if creating entries at the same time. This means that you must not mind the counter incrementing even if a user subsequently cancels the new item without saving.




回答3:


As you noticed in opening/saving an item, The Calculated Column is updated on every item change. Does it work to have a Workflow read the Title and write (the same) Title? The [ID] reference in the Calculated Column should be set. No need for an extra LookupID column then.



来源:https://stackoverflow.com/questions/24014806/calculated-sharepoint-column

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!