These macros are used to define a local variable of object (local object) or value type or to unset them.
.set_object ( [scope.] name [,object-ref [,mode]])
.set_value ( [scope.] name, value [,mode] [,unescape])
.unset ( [scope.] name)
The following parameters are available:
Parameter |
Description |
---|---|
scope |
[optional] Specifies the qualifying scope. If no scope is set, then the scope is the object with the current scope. Use the this keyword to explicitly give a scope of the current object, or Parent to give a scope of the parent object. Type: Simple-template returning an object or a collection scope |
name |
Specifies the name of the object or variable, which you can reference elsewhere in the template in the form of %name%. Type: Simple-template |
object-ref |
[.set_object only - optional] Specifies an object reference. If no reference is specified or an empty string is given, the variable is a reference to the active object in the current translation scope. Type: [scope.]object-scope] |
value |
[.set_value only] Specifies the value to give to the variable. Type: Simple template (escape sequences ignored) |
mode |
[optional] Specifies the mode of creation. You can choose between:
|
unescape |
[.set_value only - optional] Specifies to interpret escaped characters such as \n in the supplied value. By default, such characters are uninterpreted. |
Examples |
---|
.set_object(Attribute1, Attributes.First) .set_value(FirstAttributeCode, %Attributes.First.Code%) %FirstAttributeCode% (OID: %Attribute1%)Result: a1 (OID: 63442F85-48DF-42C8-92C1-0591F5D34525) |
.set_value(this.key, %Code%-%ObjectID%)Result: C1-40D8F396-EE29-4B7B-8C78-E5A0C5A23325 |
.set_value(i, 1, new) %i?% .unset(i) %i?%Result: true falseThe first call to %i?% outputs true as the variable i is defined, and the second outputs false, because it has been unset. |
.set_value(oneline, "line1\nline2") .set_value(twolines,"line3\nline4",, unescape) %oneline% %twolines%Result: line1\nline2 line3 line4 |
.set_value(i, Code) %*i%