Search code examples
sharepointsharepoint-2007moss

Custom field type derived from SPFieldCalculated


I am trying to create a custom field type which will display values based on another field in the same list. (basically, display some images based on the value of the source column)

Since this column derives it's data entirely on the basis of another column, i need to make sure the column values are not stored in the database.

So, i think i need to create a custom field type which derives from SPFieldCalculated class.

But, when i try to do so, I get an error message "The type 'Microsoft.SharePoint.SPFieldCalculated' has no constructors defined"

How do i create a custom field tpye deriving from SPFieldCalculated? If this is not possible, can somebody at least tell me how do i go about satisfying my requirement?


Solution

  • In the fieltype xml you can add in the CAML of the template a LookupColumn. in you question you can use a field type text and in the DisplayPattern write something like this.

    <RenderPattern Name="DisplayPattern">
        <HTML><![CDATA[<img src="]]></HTML>
          <LookupColumn Name="FileLeafRef" HTMLEncode="TRUE" />
        <HTML><![CDATA["/>]]></HTML>
    </RenderPattern>