sharepointsharepoint-2007spfield

SharePoint calculated field based on another hidden field


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!


Solution

  • 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.