Calculated Columns in ContentTypes

Creating and using Calculated Columns in your ContentTypes are a bit tricky.

First off the syntax for defining a Calculated column is like

<Field ID="{Some GUID}" Name="Name" Group="GroupName" Type="Calculated" DisplayName="Display Name" StaticName="Name" FromBaseType="TRUE" ResultType="Number/Text" ReadOnly="TRUE">
    <Formula>Some Forumula</Formula>
        <FieldRefs>
            <FieldRef Name="Name of Field Referred"/>
        </FieldRefs>
</Field>

For the calculated column to work in multiple ContentTypes each of the fields referred in calculation should be a part of the ContentType and ...

<the most vital part as it caused me a lot of pain yesterday and took a while to figure out >

... the referred columns should have the same Display Name in the ContentType as when Columns were originally defined. That is you cant use a column referred in a ContentType and change its Display Name within the ContentType.

 

tags: , , ,

Cross-posted from tariqayad.com

Print | posted on Tuesday, September 19, 2006 9:25 PM

Comments on this post

No comments posted yet.

Your comment:

 (will show your gravatar)
 
Please add 6 and 3 and type the answer here: