Chapter 5 Managing Global Variables (2)

Look up values in global variables

The Find Global Variable String page makes it possible to find a given string in a subscript or the value of a selected global variable.

To access and use this page do the following:

  1. The Global Variables page is displayed.
  2. Select the global variable to use. For this, see steps 2 and 3 in the Global Page Introduction section.
  3. Click the Find button.
  4. For what to look for, enter a string to search for.
  5. (Optional) Clear case matching. By default, searches are case sensitive.
  6. Click Find First or Find All.

The page then displays the first node or all nodes in the selected global variable whose subscript or value contains the given string. The node subscripts are displayed on the left side of the table and the corresponding values are displayed on the right side.

  1. If you are using Find First, click Find Next as needed to see the Next node.
  2. When finished, click to close the window.

Perform batch replacement.

Note: Before making any edits, make sure you know which global system IRIS uses and which global system your application uses; See “General Advice” This option permanently changes the data. It is not recommended to use in production systems.

For development purposes, the Find Global String page also provides the option to make an overall change to the value in the global node. To use this option:

  1. The Global page is displayed.
  2. Select the global to use. For this, see steps 2 and 3 in the “Introduction to Global Pages” section
  3. Click the Replace button.
  4. Use this page to find the values described in the previous section.
  5. Specify a value for replace with.
  6. Click Replace All.
  7. Click OK to confirm the operation. The page then displays a preview of the changes.
  8. If the result is acceptable, click Save.
  9. Click OK to confirm the operation.

Exporting global variables

Note: Because importing globals is very easy (this is an irreversible change), it is best to export only globals that need to be imported. Note that if you export all global variables, the export will include all global variables that contain code. Make sure you know which global systems IRIS uses and which applications use;

You can export global information on the Export Global page.

To access and use this page:

  1. The Global page is displayed.
  2. Specify the global to use. For this, see steps 2 and 3 in the “Introduction to Global Pages” section
  3. Click the Export button.
  4. Specifies the file to which the global file is exported. To do this, enter the filename (including its absolute or relative pathname) in the export path and name field on the input server < hostname >, or click browse and navigate to the file.
  5. Use the character set list to select the character set for the exported file.
  6. In the center box of the page: Select output Format, select Record format
  7. Select or clear Check Here to run the export in the background…
  8. Click Export.
  9. If the file already exists, click OK to overwrite it with the new version.

The export creates a.gof file.

Importing global variables

Note: Before importing any global variables, make sure you know which ones IRIS uses and which ones your application uses; See “General Advice” no undo option. After importing a global into an existing global (thus merging data), you cannot restore the global to its previous state.

The Import Global page allows global import. To access and use this page:

  1. The Global page is displayed.
  2. Click the Import button.
  3. Specify the import file. To do this, enter the file (including its absolute or relative pathname) in the path and name field of the input import file, or click browse and navigate to the file.
  4. Select the character set for the import file using the character set list.
  5. Choose the next step.
  6. Use the check box in the table to select the global to import.
  7. You can also choose to run the import in the background. If selected, the task will run in the background.
  8. Click Import.

Delete global variables

Note: Before removing any global variables, make sure you know which ones IRIS uses and which ones your application uses; See “General Advice” no undo option. Deleted global cannot be recovered.

You can delete a global on the Delete Global page. To access and use this page:

  1. The Global page is displayed.
  2. Select the global to use. For this, see steps 2 and 3 in the “Introduction to Global Pages” section
  3. Click the Delete button.
  4. Click OK to confirm the operation.

An application program interface to manage tasks

InterSystems IRIS also provides the following application programming interfaces to perform some of the tasks described in this chapter:

  • class%SYSTEM.OBJThe following methods are provided:
    • Export()Enables global export to an XML file.
    • Load()andLoadDir()Enable import inclusion inXMLGlobal in a file.

Both can be obtained by the SYSTEM variable, e.g. ‘SYSTEM’, e.g. ‘system.obj.export’

  • category%Library.GlobalThe following methods are provided:
    • Export()Enables the global export to.gofAnd other file formats (excluding XML).
    • Import()Enables global import to.gofAnd other file formats (excluding XML).

% library.global also provides a Get() class query that can be used to look up globally, depending on a given search criteria.