GetVar Element
The GetVar element returns a variable in the context of rendering the page. Variables can either be set locally to the current level of XML, or they can be set globally to the page.
<GetVar
AutoHyperlink = "TRUE" | "FALSE"
AutoNewLine = "TRUE" | "FALSE"
Default = "TRUE" | "FALSE"
HTMLEncode = "TRUE" | "FALSE"
Name = "Text"
NoURLEncode = "TRUE" | "FALSE"
StripWS = "TRUE" | "FALSE">
</GetVar>
Attributes
Name | Description |
---|---|
AutoHyperlink | Optional Boolean. TRUE if <A> tags are added to text if it looks like a hyperlink. |
AutoNewLine | Optional Boolean. TRUE if <BR> tags are inserted into the text stream and multiple spaces are replaced with non-breaking spaces ( ). |
Default | Optional Text. Renders the text assigned to this attribute if the value returned by Select is an empty string. |
HTMLEncode | Optional Boolean. Converts embedded characters so that they are displayed as text in the browser. In other words, characters that could be confused with HTML tags are converted to entities. |
Name | Required Text. The name of the variable. |
NoURLEncode | Optional Boolean. FALSE if special characters, such as spaces, are converted to quoted Unicode format (e.g. %u0020). |
StripWS | Optional Boolean. TRUE if white space is removed from the beginning and end of the value returned by the Column element. |
Related Elements
Parent Elements |
---|
Case, Default, Expr, Expr1, Expr2, Limit, ListFormButtons, ListFormOpening, PagedRowset, ScriptQuote, SetList, SetVar, Toolbar, ViewBody, XML |
Remarks
This element is often used within an Expr element in a Switch or IfEqual element.
If Scope="Request" is specified in the SetVar element, a variable assignment will take effect anywhere in the current page. Otherwise, the assignment only affects children of the SetVar element.
Example
In the following example,
<ows:XML>
<SetVar Name="MyVariable">GlobalBar</SetVar>
<Sample>
<SetVar Name="MyVariable">LocalBar</SetVar>
<GetVar Name="MyVariable"/>
</Sample>
<GetVar Name="MyVariable"/>
</ows:XML>
the first GetVar would return LocalBar, while the second one would return GlobalBar, because the SetVar for LocalBar only applies to children of the "Sample" element; after </Sample>, LocalBar goes out of scope.