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.

WRITEWRITE ##class(Patient)patient.AdmitDateIsValid(date)NotesWRITE with $X and $YA WRITE displays the characters resulting from the expression evaluation one at a time inleft-to-right order. <strong>Caché</strong> records the current output position in the $X and $Y special variables,with $X defining the current column position and $Y defining the current row position. Aseach character is displayed, $X is incremented by one.In the following example, the WRITE command gives the column position after writing the11–character string Hello world.WRITE "Hello world"," "_$X," is the column number"Note that writing a blank space between the displayed string and the $X value (," ",$X)would cause that blank space to increment $X before it is evaluated; but concatenating ablank space to $X (," "_$X) displays the blank space, but does not increment the value of$X before it is evaluated.Even using a concatenated blank, the display from $X or $Y does, of course, increment $X,as shown in the following example:WRITE $Y," "_$XWRITE $X," "_$YIn the first WRITE, the value of $X is incremented by the number of digits in the $Y value(which is probably not what you wanted). In the second WRITE, the value of $X is 0.With $X you can display the current column position during a WRITE command. To controlthe column position during a WRITE command, you can use the ? format control character.The ? format character is only meaningful when $X is at column 0. In the following WRITEcommands, the ? performing indenting:WRITE !?5,"Hello world"WRITE "Hello",!?5,"world"WRITE with Integer ExpressionsThe *integer-expression form allows you to write an integer code to the current device. Notethat integer-expression can specify an arithmetic expression or variable name (local variable,process-private global, or global). The only requirement is that the resulting value be a positiveinteger. Integers in the range 0 to 255 correspond to the ASCII character set. Integers in therange 0 to 65534 correspond to the Unicode character set.<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 165

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

Saved successfully!

Ooh no, something went wrong!