The properties of an object are the characteristics that describe the object. For example, the properties of a particular keyboard may be its color and the number of keys (e.g., the color property of that particular keyboard (object) is white and it has 90 keys). The properties of an object are also called the instance variables for the object.
Database file definitions define all properties of objects in the Record class. For example, the DEP file definition defines all the properties (i.e., data items) of the RecordDEP object.
Property References
References to Record class properties (e.g., dep.bal) return objects of the class of the schema element (e.g., Blob, Boolean, Date, Number, String), not an object of the Column class. To maintain backward compatibility with existing PSL code, the property names (des, journal, key, len, oldVal, req, typ) refer to the Column class and not the underlying schema. This does not cause a conflict, because none of the underlying schema classes contain properties with these names.
Other classes (e.g., Column class, Error class, OI class) may also be instantiated as objects. However, to define a property associated with them, an additional layer of property definition has been added to the OBJECT global (i.e., table OBJECTPROP). Effectively, the properties are the same. You can set or read these properties after the object is created.
The only real difference is that the Record class properties refer to a location in the database, while the other class' properties refer to a virtual record that does not exist in the database.
Example - Objects of Record Class Properties
The following example illustrates the PSL script and generated M code that results when references are made to Record class properties.
PSL Sample Script
#optimize
type RecordDEP dep=Db.getRecord("DEP",1)
set x=dep.bal
set x=dep.bal.curval
set x=dep.bal.des
set x=dep.bal.oldval
set x=dep.bal.piece("|",2)
set x=dep.lnm.extract(1,20)
if dep.lnm.beginsWith("SM")
if dep.lnm.isNull()
Generated M code
; #optimize
N dep,vod1 S dep=$$vDb2(1)
;
S vod1=$G(^ACN(1,51))
;
S x=$P(vod1,"|",1)
S x=$P(vod1,"|",1)
S x="Ledger Balance"
S x=$S($D(vobj(dep,-100,51,"BAL")):$P($E(vobj(dep,-100,51,"BAL"),5,9999^
;
S x=$PIECE($P(vod1,"|",1),"|",2)
;
S x=$PIECE($P(vod1,"|",1),"|",2)
S x=$E($P(dep,"|",6),1,20)
I ($E($P(dep,"|",6),1,2)="SM")
I ($L($P(dep,"|",6))=0)
;
Q