DisplayPattern element (List)

Applies to: SharePoint 2016 | SharePoint Foundation 2013 | SharePoint Online | SharePoint Server 2013

Used in computed fields to define how the field is rendered. The DisplayPattern section in the declaration for a computed field describes how the constituent fields are combined to form the computed field. For example, LinkTitle is a computed field type that combines Title and ID fields for a particular list item.

<DisplayPattern>
</DisplayPattern>

Elements and attributes

The following sections describe attributes, child elements, and parent elements.

Attributes

None

Child elements

Numerous

Parent elements

Occurrences

  • Minimum: 0
  • Maximum: 1

Remarks

The DisplayPattern element is used in Schema.xml, Onet.xml and Base.xml files.

The built-in data types (such as Integer and Text) also have display patterns, which are defined in the FldTypes.xml file. The Field element can contain display patterns and, for this reason, can be used to apply rich formatting to values (unlike the Column element, which simply returns raw data).

Example

The following 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>