Caché Class Definition Reference
[Back] [Next]
Go to:

Specifies code that sets the value of this property.
To specify how the property is computed, use the following syntax:
Property name As classname [ SqlComputeCode = { Set {FieldName} = Expression }, SqlComputed ];
If this keyword is specified (and if SqlComputed is true), then this property is a computed property. See Defining a Computed Property in Using Caché Objects.
This keyword specifies Caché ObjectScript code that sets the given field value. The value of this keyword usually has the following form:
 Set {Field} = {Other}
Within the code, all field names are enclosed within { }. The code must refer to the SQL field names rather than to the property names, if those are different. The code should include a Set command that sets the value of the current field (enclosed within {}). The field being computed can also be designated using {*}. There can be multiple Set commands, if necessary. Blank spaces are permitted before or after the equal sign, though each entire Set statement must appear on a single line. The code can include embedded SQL. It can also call class methods if it uses the full ##class(package.class).method() syntax. The code is called with a Do command.
If you intend to index this field, use deterministic code, rather than nondeterministic code. Caché cannot maintain an index on the results of nondeterministic code because it is not possible to reliably remove stale index key values. (Deterministic code returns the same value every time when passed the same arguments. So for example, code that returns $h is nondeterministic, because $h is modified outside of the control of the function.)
Any user variables used in the SqlComputeCode should be New'd before they are used. This prevents any conflict with variables of the same name elsewhere in related code.
For further information on field names in Caché ObjectScript code, see CREATE TRIGGER in the Caché SQL Reference.
The default is an empty string.
See Also