11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Caché</strong> <strong>ObjectScript</strong> Commandswith the doctor of the specified patient. The same cascading dot syntax can be used withobject methods.A SET command for objects can be used with system-level methods, such as the followingdata type property method:SET x=patient.NameIsValid(name)In this example, the NameIsValid() property method returns its result for the current patientobject. NameIsValid() is a boolean method generated for data type validation of the Nameproperty. Thus, this command sets x to 1 if the specified name is a valid name, and sets x to0 if the specified name is not a valid name.NotesEach variable assignment can be a local variable, a process-private global, or a global, the$PIECE function, the $EXTRACT function, and certain special variables, including$DEVICE, $X, $Y, $KEY, $ECODE, and $ETRAP.If the target variable does not already exist, SET creates it and then assigns the value. If itdoes exist, SET replaces the existing value with the assigned value.SET and SubscriptsYou can set individual subscripted values (array nodes) for a local variable, process-privateglobal, or a global. You can set subscripts in any order. If the variable subscript level doesnot already exist, SET creates it and then assigns the value. Each subscript level is treated asan independent variable; only those subscript levels set are defined. For example:KILL myarraySET myarray(1,1,1)="Cambridge"WRITE !,myarray(1,1,1)SET myarray(1)="address"WRITE !,myarray(1)In this example, the variables myarray(1,1,1) and myarray(1) are defined and contain values.However, the variables myarray and myarray(1,1) are not defined, and return an error when invoked. For further information on subscripted variables, refer to GlobalStructure in Using <strong>Caché</strong> Multi-Dimensional Storage.Order of Evaluation<strong>Caché</strong> evaluates the arguments of the SET command in strict left-to-right order. For eachargument, it perform evaluation in the following sequence:130 <strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!