“计算列不能包含像今天和我这样的易失函数” Sharepoint上的错误消息 [英] "Calculated columns cannot contain volatile functions like Today and Me" error message on Sharepoint

查看:75
本文介绍了“计算列不能包含像今天和我这样的易失函数” Sharepoint上的错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将新的计算列添加到共享点列表,以显示经过的日期。我输入名称并写一个公式

I try to add a new calculated column to sharepoint list that will show elapsed day. I enter name and write a formula like;

= ABS(ROUND(Today-Created; 0))

=ABS(ROUND(Today-Created;0))

此公式返回的数据类型为:单行文本

当我要保存时,出现类似

When I want to save I get an error like


的错误。计算列不能包含诸如Today和
Me之类的易失函数。

Calculated columns cannot contain volatile functions like Today and Me.


推荐答案

计算的列值仅根据需要重新计算

SharePoint列中的值(甚至在计算列中)也存储在SharePoint的基础SQL Server数据库中。

The values in SharePoint columns--even in calculated columns--are stored in SharePoint's underlying SQL Server database.

在加载页面时不执行计算列中的计算;而是仅在更改项目时重新计算它们(在这种情况下,仅针对该特定项目重新计算公式),或者在列公式更改时(在所有情况下重新计算所有项目的公式)。

The calculations in calculated columns are not performed upon page load; rather, they are recalculated only whenever an item is changed (in which case the formula is recalculated just for that specific item), or whenever the column formula is changed (in which case the formula is recalculated for all items).

(作为旁注,这就是为什么在SharePoint 2010中不能在列表视图阈值超过5000的列表上创建或更改计算列的原因;要求大量更新所有这些项目中的值,这可能会影响数据库性能。)

(As a side note, this is the reason why in SharePoint 2010 you cannot create or change a calculated column on a list that has more than the list view threshold of 5000 items; it would require a mass update of values in all those items, which could impact database performance.)

因此,为了使计算出的列准确存储 Me之类的易失值和今天,SharePoint需要以某种方式不断重新计算这些列值,并不断更新数据库中的列值。

Thus, in order for calculated columns to accurately store "volatile" values like "Me" and "Today", SharePoint would need to somehow constantly recalculate those column values and continuously update the column values in the database. This simply isn't possible.

计算列的替代方案

我建议


  1. 条件格式:可以完全采用另一种方法,而不是为此目的而使用计算列。条件格式以突出显示符合某些条件的记录。可以使用SharePoint Designer或HTML / JavaScript完成。

  2. 过滤列表视图:由于列表视图是实时查询和生成的,因此可以使用volatile列表视图过滤器中的值。您可以设置一个列表视图Web部件,仅显示已创建等于 [Today] 的项目。由于您可以在一个页面上放置多个列表视图Web部件,因此您可以在一个部分中放置今天的商品,在另一个Web部件中放置所有其他物品,从而在视觉上实现分隔。

  3. 工作流程,计时器作业或计划任务:您可以使用重复过程每天设置正常(非计算)列的值。您需要谨慎使用此方法以确保良好的性能。例如,如果列表超过列表视图阈值,则不希望它查询和更新列表中的每个项目。

  1. Conditional Formatting: You can apply conditional formatting to highlight records that meet certain criteria. This can be done using SharePoint Designer or HTML/JavaScript.
  2. Filtered List views: Since views of lists are queried and generated in real time, you can use volatile values in list view filters. You can set up a list view web part that only shows items where Created is equal to [Today]. Since you can place multiple list view web parts on one page, you could have one section for today's items, and another web part for all the other items, giving you a visual separation.
  3. A workflow, timer job, or scheduled task: You can use a repeating process to set the value of a normal (non-calculated) column on a daily basis. You need to be careful with this approach to ensure good performance; you wouldn't want it to query for and update every item in the list if the list has surpassed the list view threshold, for example.

这篇关于“计算列不能包含像今天和我这样的易失函数” Sharepoint上的错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆