I am trying to create some fields, a content type, a list definition and a list instance in Visual Studio. All of my fields are working, showing up in the list etc. except for calculated fields. What happens when I view the list is the calculated fields are there, but their title is blank and clicking on them causes the error:
Cannot show the value of the filter. The field may not be filterable or the number of items returned exceeds the list view threshold enforced by the administrator.
Here is an example of the markup for a working field, and a calculated field that is not working (which relies on the first field) from Elements.xml:
<Field ID="{c43a0f19-4e87-4b84-99fd-cad842b2f581}"
Name="TestDate"
StaticName="TestDate"
Type="DateTime"
DisplayName="Test Date"
Required="TRUE"
Format="DateOnly">
</Field>
<Field Type="Calculated"
DisplayName="Date Month"
Format="DateOnly"
ResultType="Text"
ReadOnly="TRUE"
ID="{88e0dc85-2aac-45dc-8c1b-2e1282e58a50}"
StaticName="DateMonth"
Name="DateMonth">
<Formula>=TEXT(TestDate,"MMMM")</Formula>
<FieldRefs>
<FieldRef Name="TestDate" ID="{c43a0f19-4e87-4b84-99fd-cad842b2f581}"/>
</FieldRefs>
</Field>
<ContentType ID="0x01005682c3d0c85948c9972ccc57915e128d"
Name="TestList"
Description="Test List"
Inherits="TRUE"
Version="0">
<FieldRefs>
<FieldRef ID="{c43a0f19-4e87-4b84-99fd-cad842b2f581}"
Name="TestDate" />
<FieldRef ID="{88e0dc85-2aac-45dc-8c1b-2e1282e58a50}"
Name="DateMonth" />
</FieldRefs>
</ContentType>
Am I doing something obviously wrong with my calculated field? Is something missing or invalid? I can't see why it isn't working while the other field works fine.