DisplayPattern Element
The DisplayPattern element is used in computed fields to define how the field is rendered. The DisplayPattern section of a computed field's declaration describes how the constituent fields are combined to form the computed field. For example, LinkTitle is a computed field that is a combination of the Title and ID fields for a particular list item.
Syntax
<DisplayPattern>
</DisplayPattern>
Related Elements
Parent Elements | Child Elements |
---|---|
Field | Column, HTML, HttpHost, HttpPath, IfEqual, IfNew, ImagesPath, Length, LookupColumn, MapToIcon, Project, URL, UrlBaseName |
Remarks
This element is used in the web server extensions ONET.XML and BASE.XML files.
The built-in data types (such as Integer, Text, etc.) also have display patterns that are declared in FLDTYPES.XML, which is how the Field element can be used to apply rich formatting (unlike the Column element, which just returns the raw data).
Example
This example creates a computed field called LinkField that combines values of the Title and ID fields to form links such as <a href="form.htm?ID=7">This is the title</a>
.
<Field Name="LinkField" Type="Computed">
<FieldRefs>
<FieldRef Name="Title"/>
<FieldRef Name="ID"/>
<FieldRefs>
<DisplayPattern>
<HTML><![CDATA[<a href="form.htm?ID="]]></HTML><Column Name="ID"/><HTML><![CDATA[">]]></HTML><Column Name="Title"/><HTML><![CDATA[</a>]]></HTML>
</DisplayPattern>
</Field>