SETVAR


The SETVAR tag defines variables for use in the HCHL file. The variables created through SETVAR have global scope. Variables are named storage locations capable of containing a certain type of data, such as a numerical value or string of text used in the program that can be modified during program execution. These variables can be used directly by a tag or a script that follows the variable definition. They can also be used by files that are called through the INCLUDE tag. Contrary to the other BMC Software tags, the SETVAR tag does not produce any direct output.

Start Tag

required

End Tag

forbidden

Syntax

<SETVAR name='variable name' value='value of variable>

Mandatory Parameters

The name parameter defines the name of the variable.

The value parameter is an expression.

Optional Additional Parameters

There are no optional parameters for this tag.

name

The name parameter defines the name of a variable to be used later in a script within the HTML page. The naming conventions for new variable names are the same as the naming rules in the Chilli language, that is:

  • The name can have a maximum length of 32 characters.
  • The name can be any combination of alphanumeric characters (that is, letters and digits, and underscores.
  • The name can be in lowercase or uppercase or a mixture of both.
  • The name can start with an underscore (_) or a letter, but not with a digit.
  • The name must not contain any spaces.
  • The name must not be a reserved statement, a function name, or a keyword.
  • The name must not be an already declared variable or constant.

Example

<SETVAR name="_hchldir" value="/myhchl">
<SETVAR name="_id" value="345">
...
<A htmlfile=(_hchldir+"/mypage.hchl?_id="+_id)>

value

The value parameter is an expression representing the value of the defined variable. The value can be a simple integer or string or it can be a rather complicated function expression surrounded by parentheses.

 

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*