Skip to main content

Using the Cross Reference List to Find Occurrences

The occurrences of symbols of a variable, a POU (program, function block, function), or a DUT can be displayed in a "cross reference list". Then you can jump from the list directly to the corresponding locations in the project.

There are two ways to search for occurrence locations of a symbol:

  • Plain text search: You manually specify a text (symbol name, placeholder) in the Cross Reference List view.

  • Search for a specific declaration:

    • In the Cross Reference List view, select the declaration from the Input Assistant.

    • The focus is on a symbol name in the POU editor and you start the cross reference search from the context menu.

    • The focus is on a symbol name in the POU editor, the Cross Reference List view is open, and the cross reference search executes automatically.

    • In the Cross Reference List view which already lists occurrence locations for several declarations, you limit these results to a specific declaration.

Cross references with text search by symbol name

Requirement: The Cross Reference List view is open.

  1. Specify a string in the field next to the name, for example the identifier of the variable for which you want to find the occurrence location in the project.

    Example: "iCounter"

    For the text search, you can use the placeholders "*" (any number of characters) or "?" (exactly any one character) in combination with a partial string of a variable identifier.

    Use "%" to search for IEC addresses.

    Examples: "%MW8", "%M*"

  2. Click the _cds_icon_show_next_location.png button to start a text search in the project.

    The Cross Reference List view opens and displays the occurrence locations for the iCounter variable. The declaration locations are always displayed in the project with the occurrence location indented.

  3. Double-click an occurrence location in the cross reference list.

    The respective object opens in the editor with the marked occurrence location.

Cross references for a specific symbol declaration

Requirement: A POU is open in the editor.

Procedure. From the POU editor, with a menu command
  1. Set the cursor at the identifier of the symbol (variable, POU) in the declaration part or implementation part.

  2. In the context menu or Edit menu, click Browse → Browse Cross References.

    The Cross Reference List view opens and shows the occurrence locations of the variables or POU.

If the Cross Reference List view is already open, then you can also search the occurrence locations for a specific result as follows:

Procedure. From the POU editor, automatically
  • In Tools → Options, in the SmartCoding category, select the Automatically list selection in cross-reference view option. Select the name of the symbol in the POU, or set the cursor in the name.

    Depending on the position of the selection or cursor, the cross reference list automatically shows the occurrence locations for the respective symbol.

Procedure. In the cross reference list view, with the Input Assistant
  • In the Cross-Reference List view, use the _cds_icon_crossref_symbol_from_input_assistant.png Input Assistant to specify a symbol name in the field next to By declaration.

    The cross reference list displays the occurrence locations for the symbol.

Procedure. In the cross reference list view, limited to a specific declaration
  • If multiple declarations for a symbol are listed in the Cross-Reference List view, for example after a text search, then you can reduce the display to one result: Select the line with the desired declaration and click the _cds_icon_limit_to_declaration.png button or click Limit Results to Current Declaration in the context menu.

    The cross reference list includes only the occurrence locations for the selected declaration.