AVAL ​
Retrieve the value from an attribute and stores it in a variable.
Syntax ​
AVAL [ as-original-type ] [ set-count-rows ]
[ set-format:strValue ] [ set-sep:strValue ] VariableName:AttributeName .
VariableName : LowerCaseIdentifier .
AttributeName : strValue .
Parameters ​
VariableName
(LowerCaseIdentifier) - The name of the variable to set.AttributeName
(strValue) - The name of the attribute to retrieve the value from.as-original-type
(modifier, optional) - When specified then the value will be according to the attribute's type. Otherwise the value will always be a string. By default this is not specified.set-count-rows
(modifier, optional) - When specified then the variable is set with the amount of rows used in a record type attribute. By default this is not specified.set-format
(strValue, optional) - The format in which to return values from an Inter-model reference type attribute.set-sep
(strValue, optional) - The separator to use between values when an Inter-model reference type attribute contains more than one value. The default is"\r\n"
.
Details ​
The AVAL
command allows to read the value of an attribute and assign it to a variable. The variable can then be used in some other parts of the AttrRep code, like with the enabled
parameter of an ATTR
.
It loads the value of the attribute with AttributeName
and assigns it to a variable with the name provided through VariableName
.
By default the value of the attribute is always provided as a strValue
. If the option as-original-type
is specified, then a numerical attribute is returned in the appropriate type (intValue
or realValue
).
For record type attributes the modifier set-count-rows
is used to get the amount of rows of the attribute. The value is always assigned as an intValue
. It is not possible to access the individual rows with AVAL
. However, this could be solved with a hidden expression type attribute.
For Inter-model reference type attributes the assigned value can be formatted with set-sep
and set-format
. Through set-sep
a custom separator can be used if there is more than one reference (default is \r\n
). With set-format
the format of each reference can be specified with the following placeholders:
%o
replaced by the object's name.%c
replaced by the class's name.%m
replaced by the model's name.%t
replaced by the model type's name.
See Also ​
Examples ​
A Notebook where the attribute "Cooperative mode" is only enabled when the value of the "Cooperative" attribute is "yes"
.
NOTEBOOK
AVAL sCooperative:"Cooperative"
CHAPTER "General"
ATTR "Name"
ATTR "Cooperative" ctrltype:check checked-value:"yes" unchecked-value:"no"
ATTR "Cooperation mode" ctrltype:radio enabled:(sCooperative = "yes")
Versions and Changes ​
Available since ADOxx 1.3