Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

FieldRef Element

SharePoint 2003

The FieldRef element is used in computed fields to refer to the constituent fields and in views to define what fields are present.

Syntax

<FieldRef
  Ascending = "TRUE" | "FALSE"
  CreateURL = "Text"
  DisplayName = "Text"
  Explicit = "TRUE" | "FALSE"
  Key = "Text"
  Name = "Text"
  RefType = "Text"
  TextOnly = "TRUE" | "FALSE"
  Type = "Text">
</FieldRef>

Attributes

NameDescription
AscendingOptional Boolean. This specifies the sort order on a FieldRef element that is defined in a view. The default value is TRUE.
CreateURLOptional Text. Specifies the URL for the .aspx file that is used to create a Meeting Workspace site.
DisplayNameOptional Text. This attribute provides the display name of the field that is referenced.
ExplicitOptional Boolean. This attribute is only supported within the ViewFields element. TRUE if the field is explicitly declared in the view definition and is not returned in a Fields enumeration inside a view.
KeyOptional Text. If set to Primary, specifies that the field is the primary key for its table and thus uniquely identifies each record in the table.
NameRequired Text. This attribute provides the internal name of the field that is referenced.
RefTypeOptional Text. Specifies the type of reference for a field in an events list.
TextOnlyOptional Boolean. Specifies that the field contains only text values.
Type

Optional Text. Specifies the function that is applied to a totals column or a calculated column. The following table describes possible values.

ValueDescription
AVGAverage value. Applies to DateTimeNumber, Integer, and Currency field types.
COUNTNumber of items. Applies to all field types that allow aggregation.
MAXMaximumn value. Applies to DateTimeNumber, Integer, and Currency field types.
MINMinimum value. Applies to DateTimeNumber, Integer, and Currency field types.
SUMSum of values. Applies to Number, Integer, and Currency field types.
STDEVStandard deviation. Applies to Number, Integer, and Currency field types.
VARVariance. Applies to Number, Integer, and Currency field types.

The values for the Type attribute are not case-sensitive.

ValueDescription
AVGAverage value. Applies to DateTime Number, Integer, and Currency field types.
COUNTNumber of items. Applies to all field types that allow aggregation.
MAXMaximumn value. Applies to DateTime Number, Integer, and Currency field types.
MINMinimum value. Applies to DateTime Number, Integer, and Currency field types.
SUMSum of values. Applies to Number, Integer, and Currency field types.
STDEVStandard deviation. Applies to Number, Integer, and Currency field types.
VARVariance. Applies to Number, Integer, and Currency field types.

Element Relationships

Parent Elements
FieldRefs, OrderBy, ViewFields

Example

The following example queries for cases where the Expires field either is null or contains a value greater than or equal to the current date.

<Query>
   <Where>
      <Or>
         <IsNull>
            <FieldRef Name="Expires" />
         </IsNull>
         <Geq>
            <FieldRef Name="Expires" />
            <Value Type="DateTime">
               <Today />
            </Value>
         </Geq>
      </Or>
   </Where>
   <OrderBy>
      <FieldRef Name="Modified" Ascending="FALSE" />
   </OrderBy>
</Query>

The following example from the SCHEMA.XML file for contacts lists specifies fields to display in the toolbar.

<ViewFields>
   <FieldRef Name="LinkTitleNoMenu"></FieldRef>
   <FieldRef Name="FirstName"></FieldRef>
   <FieldRef Name="WorkPhone"></FieldRef>
   <FieldRef Name="Email"></FieldRef>
</ViewFields>

Related Topics

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.