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.

XECUTE2 3 4 5 6NotesXECUTE and ObjectsYou can use XECUTE to call object methods and properties and execute the returned value,as shown in the following examples:XECUTE patient.NameXECUTE "WRITE patient.Name"XECUTE and FORIf an XECUTE argument contains a FOR command, the scope of the FOR is the remainderof the argument. When the outermost FOR in an XECUTE argument is terminated, theXECUTE argument is also terminated.XECUTE and DOIf an XECUTE command contains a DO command, <strong>Caché</strong> executes the routine or routinesspecified in the DO argument or arguments. When it encounters a QUIT, it returns controlto the point immediately following the DO argument.For example, in the following commands, <strong>Caché</strong> executes the routine ROUT and returns tothe point immediately following the DO argument to write the string “DONE”.XECUTE "DO ^ROUT WRITE !,""DONE"""XECUTE and GOTOIf an XECUTE argument contains a GOTO command, <strong>Caché</strong> transfers control to the pointspecified in the GOTO argument. When it encounters a QUIT, it does not return to the pointimmediately following the GOTO argument that caused the transfer. Instead, <strong>Caché</strong> returnscontrol to the point immediately following the XECUTE argument that contained the GOTO.In the following example, <strong>Caché</strong> transfers control to the routine ROUT and returns controlto the point immediately following the XECUTE argument to write the string “FINISH”. Itnever writes the string “DONE”.XECUTE "GOTO ^ROUT WRITE !,""DONE""" WRITE !,"FINISH"XECUTE and QUITThere is an implied QUIT at the end of each XECUTE argument.<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 173

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

Saved successfully!

Ooh no, something went wrong!