<@VAR NAME=name [SCOPE=scope] [ELEMENT=Xpointer] [TYPE=text] [ENCODING=encoding] [FORMAT=format] [{array attributes}]>
<@VAR> retrieves the contents of a variable, and, depending on the operation being performed, formats the data appropriately. Any of the attribute values of <@VAR> may be specified by other meta tags.
When retrieving the contents of a text (standard variable), the result of <@VAR> is always a text string.
<@VAR> may also be used to retrieve an array. However, <@VAR> does different things to arrays based on context: <@VAR> converts the array to text whenever the result of the tag is returned in Results HTML, or when TYPE=text is specified; <@VAR> returns an internal reference to the array when it is used to copy an array from one place to another. So, if <@VAR> is used within <@ASSIGN>, then no conversion to text is performed (unless the TYPE="text" attribute is specified).
There are array-returning attributes that can be used to specify prefixes and suffixes for the returned array, rows within the array, and columns within the rows. They are described in the section Array-to-Text Conversion Attributes. By default, the returned array is formatted as an HTML table.
<@VAR> can be used to retrieve all or part of a document instance (XML) variable. The ELEMENT attribute can specify part of the document instance using Xpointer syntax. For more information on using Xpointer to return DOM variables, see Chapter 9 of the User's Guide.
A document instance is returned by <@VAR> as XML with no conversion of characters to HTML entities if the ENCODING attribute is not present. No conversion occurs even when XML is placed in HTML (for example, to be displayed as a Web page). All other ENCODING attribute settings function normally.
You can display encoded XML by first assigning the XML text to a variable (using the TYPE=TEXT attribute, which forces XML to be returned, not a document instance), and then returning the value of that variable in the HTML. The default encoding of variables returned with <@VAR> then takes place, for example:
<@ASSIGN tempXML <@VAR myDOM
TYPE=TEXT>>
<@VAR tempXML>
The XML is returned with the appropriate text converted to HTML entities.
Scoping is the method by which variables can be organized and disposed of in an orderly and convenient fashion. There are various levels of scoping, each of which has an appropriate purpose:
For more information, see Configuration Variables.
For more information, see domainScopeKey and Chapter 8 and Chapter 24 of the User's Guide, or the Application Server Getting Started Guide.
For more information, see Chapter 8 and Chapter 24 of the User's Guide or the Application Server Getting Started Guide.
For more information, see userKey, altuserKey and Chapter 8 of the User's Guide.
There are two methods of specifying a variable with a particular scope.
The behavior is undefined when both methods are used at once.
When no scope is specified, Tango must find the variable by looking for the variable name within the various scopes. Tango has a set order in which it tries to find scopes. They are:
(in a Tango application file)
local--»user--»application--»domain--»system
(in a Tango class file)
method--»instance--»local--»user--»application--»
domain--»system
Note: Variable scoping
precedence for variables and configuration variables does not check cookie
scope.
For more information, see domainScopeKey.
If domainScopeKey resolves to empty for the current user, then domain is not checked. If there is no current application, application scope is not checked.
There is a shortcut syntax for returning variables as well, with or without scope: use a double @ and the name of the variable. The following two notations in each of the examples are equivalent:
<@VAR NAME="homer"
SCOPE="domain">
@@domain$homer
For a detailed list of configuration variables, see Chapter 2 of this manual.
Tango reserves special variables that contribute to the configuration of the server and also that provide default behaviors for users.
For more information, see "About Variables" in Chapter 8 of the User's Guide. For more information on setting configuration variables using the config.taf file, see the Application Server Getting Started Guide or Chapter 24 of the User's Guide.
Configuration variables that control basic configuration of the server only exist in the system scope. Some configuration variables are valid in all scopes, or some scopes (for example, certain configuration variables are valid only in application and system scope); if so, they are subject to the full scoping mechanism described previously. Default values read from the preference file are stored in the system scope.
<@VAR NAME="foo"
SCOPE="local">
<@VAR NAME="local$foo">
@@local$foo
<@VAR NAME="foo"
SCOPE="user">
<@VAR NAME="user$foo">
@@user$foo
<@VAR NAME="foo" SCOPE="usr">
<@VAR NAME="usr$foo">
@@usr$foo
Accessing a system scope variable:
<@VAR NAME="foo"
SCOPE="system">
<@VAR NAME="system$foo">
@@system$foo
<@VAR NAME="foo" SCOPE="sys">
<@VAR NAME="sys$foo">
@@sys$foo
Accessing a domain scope variable:
<@VAR NAME="foo"
SCOPE="domain">
<@VAR NAME="domain$foo">
@@domain$foo
Accessing variable using scoping precedence:
Getting an array and formatting it for Results HTML:
Getting part of an array and formatting it for Results HTML:
Getting an array and formatting it for Results HTML with attributes:
<@VAR NAME="array" APREFIX='<TABLE BORDER="2">' ASUFFIX= </TABLE>' RPREFIX='<TR>' RSUFFIX='</TR>' CPREFIX='<TD BORDER="2">' CSUFFIX='</TD>'>
Copying an array without formatting it (converting it to text):
<@ASSIGN NAME="array2" VALUE="<@VAR NAME='array'>">
Copying part of an array without formatting it:
<@ASSIGN NAME="array2" VALUE="<@VAR NAME='array[*,4]'>">
Copying the formatted representation of an array to a variable:
<@ASSIGN NAME="array2"
VALUE="<@VAR NAME='array'
FORMAT=text>">
Getting a document instance variable (XML) and performing no encoding on it:
Getting part of a document instance variable:
<@VAR NAME="myDom" ELEMENT="root().child(2)">
<@ASSIGN NAME="myDom2" VALUE="<@VAR NAME='myDom'>">
Copying part of a document instance:
<@ASSIGN NAME="myDom2"
VALUE="<@VAR NAME='myDom'
ELEMENT='root().child(2)'>">
Array-to-Text
Conversion Attributes
<@ARRAY>
<@ASSIGN>
Encoding Attribute
Format Attribute
Copyright © 1999, Pervasive Software. All rights reserved.