11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

$DATAWhen executed, this code might produce output similar to the following:Output how many records: 3Start with record number: 10Name: Jane SmithAddress: 74 Hilltop Dr., Beverly, MA 01965Account: Checking #: 34218 Balance: 876.72Account: Reserve Credit #: 47821 Balance: 1200.00Name: Thomas BrownAddress: 46 Huron Ave., Medford, MA 02019Account: Checking #: 59363 Balance: 205.45Account: Savings #: 41792 Balance: 1560.80Account: Reserve Credit #: 64218 Balance: 125.52Name: Sarah CopleyAddress: No DataAccount: Checking #: 30021 Balance: 762.28NotesNaked Global <strong>Reference</strong>s$DATA sets the naked indicator when used with a global variable. The naked indicator isset even if the specified global variable in not defined (Status Value = 0).Subsequent references to the same global variable can use a naked global reference, as shownin the following example:IF $DATA(^A(1,2,3))#2 {SET x=^(3) }For further details on using $DATA with global variables and naked global references, seeUsing Multi-Dimensional Storage (Globals) in Using <strong>Caché</strong> Multi-Dimensional Storage.Global <strong>Reference</strong>s in a Networked EnvironmentUsing $DATA to repeatedly reference a global variable that is not defined (for example,$DATA(^x(1)) where ^x is not defined) always requires a network operation to test if theglobal is defined on the ECP server.Using $DATA to repeatedly reference undefined nodes within a defined global variable (forexample, $DATA(^x(1)) where any other node in ^x is defined) does not require a networkoperation once the relevant portion of the global (^x) is in the client cache.For further details, refer to Developing Distributed Applications in the <strong>Caché</strong> DistributedData Management Guide.Functions Related to $DATAFor related information, see $GET and $ORDER. Since $ORDER selects the next elementin an array that contains data, it avoids the need to perform $DATA tests when loopingthrough array subscripts.<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 199

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

Saved successfully!

Ooh no, something went wrong!