Skip to main content

A Subscripted Global and its Descendants

A Subscripted Global and its Descendants

The following example shows ZWRITE displaying the contents of a subscripted global variable and all of its descendent nodes. This example displays the data defined for the Sample.Person persistent class that projects to an SQL table. The global variable takes its name from the persistent class name (not the SQL table name) and is case-sensitive; a “D” is appended to indicate a data global. Note that the descendent nodes contain list structures, which are displayed as $LISTBUILD ($lb) constructions:

   ZWRITE ^Sample.PersonD

To display a single data record, you can specify the RowID value as the global subscript, as shown in the following:

   ZWRITE ^Sample.PersonD(22)

To display the contents of an index, you can specify the persistent class name with an “I” appended, supplying the index name as the subscript. The index name is case-sensitive:

  ZWRITE ^Sample.PersonI("NameIDX")

Additional non-printing characters used in lists are also displayed.

The following example shows ZWRITE using extended global reference to display the contents of a subscripted global variable located in a specified namespace:

   ZWRITE ^["USER"]Sample.PersonD

The namespace name can be a different namespace or the current namespace. Namespace names are not case-sensitive.

ZWRITE always displays the extended global reference, regardless of the setting of the RefInKind method or property, which can be set to strip extended global references from globals returned by $QUERY or $NAME.

FeedbackOpens in a new tab