The Variable class gives access to variables in Reporter. More...
The REPORTER JavaScript API provides many class constants, properties and methods. For Arup to
be able to extend and enhance the API in the future any constant, property or method names beginning with a lowercase
or uppercase letter are reserved.
If you need to add your own properties or methods to one of the existing classes then to avoid any potential future conflict you
should ensure that the name begins with either an underscore (_) or a dollar sign ($) or the name is prefixed with your
own unique identifier.
For example if company 'ABC' need to add a property called 'example' then to avoid any potential future conflict use one of:
| Name | Description |
| Variable.DESCRIPTION | Show variable description when editing variables with Template.EditVariables() |
| Variable.FORMAT | Show variable format when editing variables with Template.EditVariables() |
| Variable.FORMAT_FLOAT | Variable has floating point number format |
| Variable.FORMAT_GENERAL | Variable has general format |
| Variable.FORMAT_INTEGER | Variable has integer format |
| Variable.FORMAT_LOWERCASE | Variable has lower case format |
| Variable.FORMAT_NONE | Variable has no format |
| Variable.FORMAT_SCIENTIFIC | Variable has scientific format |
| Variable.FORMAT_UPPERCASE | Variable has upper case format |
| Variable.NAME | Show variable name when editing variables with Template.EditVariables() |
| Variable.PRECISION | Show variable precision when editing variables with Template.EditVariables() |
| Variable.READONLY | Show variable readonly status when editing variables with Template.EditVariables() |
| Variable.TEMPORARY | Show variable temporary status when editing variables with Template.EditVariables() |
| Variable.TYPE | Show variable type when editing variables with Template.EditVariables() |
| Variable.VALUE | Show variable value when editing variables with Template.EditVariables() |
| Name | Type | Description |
| description | string | Variable description |
| format | constant | Variable format. Can be Variable.FORMAT_NONE, Variable.FORMAT_FLOAT, Variable.FORMAT_SCIENTIFIC, Variable.FORMAT_GENERAL, Variable.FORMAT_INTEGER, Variable.FORMAT_UPPERCASE or Variable.FORMAT_LOWERCASE |
| name | string | Variable name |
| precision | integer | Variable precision for floating point numbers. |
| readonly | logical | If Variable is read only or not. |
| temporary | logical | If Variable is temporary or not. |
| type | string | Variable type. Predefined types are "Directory", "File(absolute)", "File(basename)", "File(extension)", "File(tail)", "General", "Number" and "String". Alternatively give your own type. e.g. "NODE ID" |
| value | string | Variable value |
Detailed DescriptionThe Variable class allows you to access the name, description and
value of a variable inside Reporter. |
Constructornew Variable(template[Template], name[string], description (optional)[string], value (optional)[string], type (optional)[string], readonly (optional)[boolean], temporary (optional)[boolean])DescriptionCreate a new Variable. The template and name arguments MUST be given, all others are optional |
Template object to create variable in
Name of variable
Description of variable
Variable value
Type of variable. Predefined types are "Directory", "File(absolute)", "File(basename)", "File(extension)", "File(tail)", "General", "Number" and "String". Alternatively give your own type. e.g. "NODE ID". If omitted default is "General"
If variable is readonly or not. If omitted default is false.
If variable is temporary or not. If omitted default is true.
ReturnsVariable object Return typeVariable |
Details of functionsGetAll(template[Template]) [static]DescriptionReturns an array of Variable objects for all of the variables in a Template. |
Template to get the variables from
ReturnsArray of Variable objects Return typeArray |
ExampleTo get all the variables in template t: var v = Variable.GetAll(t);
|
GetFromName(template[Template], name[string]) [static]DescriptionReturns the Variable object for a variable name. |
Template to find the variable in
name of the variable you want the Variable object for
ReturnsVariable object (or null if variable does not exist) Return typeVariable |
ExampleTo get the Variable object for variable EXAMPLE in template t: var v = Variable.GetFromName(t, "EXAMPLE");
|
Remove()DescriptionRemove a variable |
No arguments
Returnsno return value |
ExampleTo remove variable data: data.Remove();
|