# Searching and Replacing References

Using the [References] window, you can search for instances of a specified source property or text in the project or compound objects. You can then use the [References] window to replace the source property or text.

The [References] window is an important tool for maintaining and adjusting projects.

1. Search field
2. Source property selector
3. Scope
4. Search command
5. Replace field
6. Replace command
7. Go To source object
8. Select the scope for search and replace
9. Search results

## Searching and Replacing References

### Search

1. Click the [References] tab.
2. From the [References] window, use the [Search] field to specify the item to search for. Click the Source Type icon and select a source property.

   Search Item | Search field
   Project | Compound Object
   [Variable], [Local Variable], [Graphic Object], [Target], [Equipment], [Alarm], [Recipe] | [Compound Object], [Local Variable], [Graphic Object] | Select the source property to search from the source property selector.
   [LanguageTable Text], [Direct Text] | [Direct Text] | Type the text to search for in project labels and text, or in compound text.
   [Converter] | [Converter] | Type the name of the converter to search for. Note: As you type the converter name, matching names are listed dynamically.
   [Security Level] | [Security Level] | Define the range of security levels to search for. For example, below is a search for security level 5.

Note: The search for [References] is an exact match search. However, you can use an asterisk (*) to narrow down the search results for search items other than [Security Level]. For example, if you select the Variable source property and type “Var*” in the search field, the search results show Variable source property references that begin with “Var”.

3. Click the Scope icon to define the scope of the search. The Scope button is disabled when a compound object is selected.

   Scope | Description
   [Select All] | Select this check box to select the check boxes of all search items and add them to the search scope. Clear this check box to clear the check boxes of all search items and remove them from the search scope.
   [Screens] | After selecting this check box to search screens, set whether to search [All Screens] or a specific screen with the [Screen ID] field.
   [Contents] | After selecting this check box to search contents, set whether to search [All Contents] or a specific content with the [Content ID] field.
   [Scripts] | Select this check box to add scripts to the search scope. After selecting this check box to search scripts, set whether to search [All Scripts], all [Global Scripts], or script associated with a specific screen or content with the [Screen ID] and [Content ID] fields.
   [Variables] | Select this check box to add variables to the search scope.
   [Converters] | Select this check box to add converters to the search scope.
   [Alarms] | Select this check box to add alarms to the search scope.
   [Languages] | Select this check box to add languages to the search scope.
   [Targets] | Select this check box to add targets to the search scope.
   [Logging] | Select this check box to add logging to the search scope.
   [Recipes] | Select this check box to add recipes to the search scope.
   [System Keypads] | Select this check box to add system keypads to the search scope.
   [Security] | Select this check box to add security to the search scope.

4. Click the Search icon to start searching.
   Items that match the search parameters appear in the search results with the following information.

   Column Name | Description
   [Target Type] | Object that matches the search parameters.
   [Target Path] | Path of the property that matches the search parameters.
   [Source Path] | Property name of the source item that matches the search parameters. If you run the replace operation, this is the item that is replaced.

5. You can use the column names to sort or filter the search results.
   Note:
   - Select an item in the search results and click [Go To source object] to jump to the target path.
   - When working in the screen editor, variable editor, or converter, the toolbar includes the Search icon . Click the icon to start a search operation with the selected object and display the search results in the [References] window.

### Replace

6. Select desired items in the search results.
7. In the [Replace] field, define the replacement for the search item.
   The replace item must match the search item.
   Click the Source Property Selector icon and select either the corresponding source property (Variable, Graphic Object, Target, Alarm, Recipe, Language Table Text) or corresponding Converter, Security Level, or Text.
8. To replace all matches in the search results, type [CTRL]+[A] to select all. To replace only select items, use [CTRL]+click to select individual items.
9. Click the replace icon to replace selected instances.
   Note: After you run replace operations, search results are not updated. As a result, the search results may not be up to date. Run search again to update the search results.
10. After running the replace operation, click the undo icon to revert the project to the same state as before the replacement operation.

Note:

- When a variable is used to define the element number in an array variable, and that array variable displays in the [Source Path] as part of a search result, using the replace operation you have the choice of replacing the array variable, the element number variable, or the full source path ([Full Replace]).
- When searching or replacing a local variable, the prefix "$Local" is added. For example, '$Local.Var1.Value'

The following are three different examples of replacement operations when working with arrays: Full Replace, replace variable element, and replace array.

Source Path | Replace Type | Replace To | Result
Array1[Var1.value].value | Full Replace | Var2.value | Var2.value
Array1[Var1.value].value | Var1 | Var2.value | Array1[Var2.value].value
Array1[Var1.value].value | Array1 | Array2 | Array2[Var1.value].value

Full Replace replaces the full source path with the selected variable.

In the second scenario, when you select the element number variable, only the selected variable is replaced.

In the third scenario, as the replace type is an array, the array variable itself is replaced.