基于另一个隐藏字段的 SharePoint 计算字段

发布于 2024-10-07 23:43:59 字数 1213 浏览 7 评论 0 原文

在生产部署中,我们有一个计算字段,它由引用其他两个隐藏字段的公式组成。这是简单的串联,带有一些用于确定版本的逻辑

=CONCATENATE(IF(_MajorVersion="","0",_MajorVersion),".",IF(_MinorVersion="","0",_MinorVersion))

用户无意中修改了列表的数据表视图中的公式,现在公式已损坏,如下所示

=CONCATENATE(IF(#NAME="","0",#NAME),".",IF(#NAME="","0",#NAME))

如果将此公式替换为损坏前的版本,它将不会保存,并给出以下错误

该公式引用了不存在的列。检查公式是否存在拼写错误或将不存在的列更改为现有列。在 Microsoft.SharePoint.Library.SPRequestInternalClass.UpdateField(字符串 bstrUrl、字符串 bstrListName、字符串 bstrXML) 在 Microsoft.SharePoint.Library.SPRequest.UpdateField(String bstrUrl, String bstrListName, String bstrXML)

列 _MajorVersion 和 _MinorVersion 确实存在,但被隐藏并定义如下:

我知道可以部署一项功能,使这些列可见,解决问题,然后重新隐藏它们。然而,要实现这一目标需要有大量的繁文缛节。有人知道在不部署代码的情况下执行此操作的方法吗?我也考虑过重新创建列表,但此列表中有数千个 SPListItem。

任何建议将不胜感激!

In a production deployment we have a calculated field which is composed of a formula that references two other hidden fields. This is simple concatenation with a little logic for determining version

=CONCATENATE(IF(_MajorVersion="","0",_MajorVersion),".",IF(_MinorVersion="","0",_MinorVersion))

A user inadvertently modified the formula in the datasheet view of the list and now the formula has become corrupted as shown below

=CONCATENATE(IF(#NAME="","0",#NAME),".",IF(#NAME="","0",#NAME))

If you replace this formula with the pre-corrupted version, it will not save, and gives the following error

The formula refers to a column that does not exist. Check the formula for spelling mistakes or change the non-existing column to an existing column. at Microsoft.SharePoint.Library.SPRequestInternalClass.UpdateField(String bstrUrl, String bstrListName, String bstrXML)
at Microsoft.SharePoint.Library.SPRequest.UpdateField(String bstrUrl, String bstrListName, String bstrXML)

The columns _MajorVersion and _MinorVersion do exist, but are hidden and defined as follows:

<Field SourceID="http://schemas.microsoft.com/sharepoint/3.0"
ID="{GUID}"
Name="_MajorVersion"
StaticName="_MajorVersion"
DisplayName="_MajorVersion"
Group="ApplicationStuff"
Type="Number"
Required="FALSE"
ReadOnly="FALSE"
Sealed="FALSE"
Hidden="TRUE"
ShowInListSettings="FALSE"
ShowInEditForm="FALSE"
ShowInDisplayForm="FALSE"
ShowInNewForm="FALSE" />

I know it is possible to deploy a feature which will make these columns visible, fix the problem, and then re-hide them. However, there is a lot of red-tape to make that happen. Anyone know of a way to do this without deploying code? I also considered re-creating the list, but there are thousands of SPListItems in this list.

Any suggestions would be appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

白日梦 2024-10-14 23:43:59

取消隐藏字段(使用某种实用程序,编写起来非常简单),保存公式并隐藏回来。但我认为您应该以其他方式填充计算字段,例如 SPD 工作流程或事件接收器。

Unhide the fields (using some kind of utility, very simple to write), save the formula and hide back. But I think you should probably fill the calculated field in some other fashion, such as SPD workflow or event receiver.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文