Case Element

The Case element is used inside a Switch statement to perform a comparison.

Syntax

<Case
  ExpandXML = "TRUE" | "FALSE"
  Value = "Text">
</Case>

Attributes

Name Description
ExpandXML Optional Boolean. TRUE if the rendered content is passed again through the CAML interpreter, which allows CAML to render CAML.
Value Optional Text. The value to check for in a comparison.
Parent Elements Child Elements
Switch Column, Column2, Field, FieldFilterOptions, ForEach, GetVar, GUID, HTML, HttpVDir, IfEqual, ImagesPath, List, ListProperty, LookupColumn, MapToIcon, Property, ScriptQuote, SetList, SetVar, Switch, TodayISO

Remarks

Within a Switch statement, the Case element is often used in conjunction with the Default element. If the criteria set by the Case value proves false, then the default value is implemented.

Example

The following example checks the value of a UserID field and returns "User Zero" if the value is 0 (zero). Otherwise, it sets a default value: "Not User Zero".

<Switch>
  <Expr><UserID/></Expr>
  <Case Value="0">User Zero</Case>
  <Default>Not User Zero</Default>
</Switch>

See Also

Universal Attributes for Page Rendering Elements****