Topic: P046

Find / Replace

Description

Find / Replace is a tool that can be used to search the Current Project for specific Tag Names, Comments or Instructions. This tool will display all locations where the searched Tag Name, Comment or Instruction can be found.  The Replace feature of this tool allows for the quick Replacement of the searched item with the Tag Name, Comment or Instruction entered in the Replace With field.

Accessing Find / Replace

There are four methods for accessing Find / Replace:

Method 1

Use the Search Icon located on the Main Toolbar.

Method 2

Use the shortcut keys Ctrl+F.

Method 3

Select the Find/Replace menu item from the Edit Menu, located on the Main Menu as shown on the right.

Selecting Find/Replace will display the window shown below with the Tag Search option selected by default.


Method 4

Right-click any contact or coil with a single tag and select Tag Search For... in the context menu:

Tag Search

The Tag Search feature of Find/Replace can be accessed directly by right clicking on a Tag and selecting Tag Search for 'Tagname'. This will automatically insert the selected Tag into the search field, begin the search, and provide the search results.

This feature can be accessed via Data View, Tag Database, or directly from Ladder.

Data View

Tag Database


Ladder

Note: Only Tags associated with Contacts and Coils may be searchable directly from ladder.

The Tag Search option provides the following:

  1. Find Tag Name: Enter the Tag Name you wish to locate in the specific project.  Either type a Tag Name to Find or click the down arrow button to pick a Tag Name from the drop down list.

Note: When Search Now is selected, the system will determine if the tag in the Find Tag Name field is an existing tag in the Tag Database. If so, the system will then execute a Full Tag Name Search. If not, a Partial Tag Name Search is performed.

A Partial Tag Name Search will locate instances of tags being used that contain the desired characters.

For example,Motor Contactor, Motor Contactor 1, and Motor Contactor 2 are tags that exist in the tag database. If a Tag Search is done for "Motor Contactor", the results will only display the instances of the tag name "Motor Contactor".


However, if a Tag Search is done for "Motor", the results will display the instances of all three tag names, "Motor Contactor, Motor Contactor 2, and Motor Contactor 3".


  1. Search Results: After the Search Now button is selected, the software will Search all areas of the project where a Tag can be used and display the findings in the Search Results portion of the window as explained below.  This is also where the user specifies which instances of the Tag should be Replaced.
      1. Search will check all areas of the project where a Tag can be used.  Each area is shown as a folder in the results.  As appropriate, some folders are further divided into sub-folders.

      2. A folder with no box next to it and no results indicates the Tag Name was not found in that area.

      3. Expand or collapse the folders by clicking the + or - next to it.

      4. Expand or collapse all folders by clicking the "Expand All" or "Callapse All" buttons.

      5. Double click a search result to view the result in context.

      6. A result with (no occurrences) next to it indicates the Tag Name was found in multiple locations within a single instruction.  To selectively change some occurrences of a Tag Name within a single instruction, open and edit the instruction in the ladder editor.

      1. Place a check mark next to a search result to select that instance for replacement.

      2. To select all or no occurrences of a Tag Name, click the Select All or Select None button.

      3. To select all or no results in a single folder, click the selection box next to the folder.

        • Checkmark : All occurrences of the Tag Name within the folder are selected for replacement.

        • No Checkmark : No occurrences of the Tag Name within the folder are selected for replacement.

        • Asterisk At least one, but not all occurrences of the Tag Name within the folder are selected for replacement.
  1. Replace With: Enter a Tag Name for replace. Type an existing Tag Name or click the button to pick one from a list.  A new Tag may be created by typing in a new name and providing the required information in the Define Tags Dialog that opens.

Note: A Partial Find and Replace only replaces the part of the tag name that is entered into the Find Tag Name field.

With our earlier Partial Tag Name Search example, when searching for "fin", if you entered "bin" into the Replace With field, three new tags would be generated.

Note: There is no checkbox next to a Tag’s occurrence in the Hardware Configuration because Find/Replace cannot be used to change which Tag (more specifically the Tag’s System ID) is assigned to Hardware.  A Tag assigned to Hardware cannot be replaced, but it can be renamed.  Here is an example of how to assign a user Tag to a Hardware point.

Example:  

You’ve written ladder with the user Boolean Tag "DI_out_lim_sw".  You add a Discrete Input card to the Hardware Configuration and you want to call Input 1 "DI_out_lim_sw".  When the module is added to the configuration, Input 1 was automatically named DI-0.1.1.1 since it was installed in Slot 1 of the CPU base.


Open Tag Database and delete the user Tag DI_out_lim_sw.

Next, go to Hardware Configuration or Tag Database and change the name of DI-0.1.1.1 to DI_out_lim_sw.
Now each occurrence, including the Hardware Configuration, will be DI_out_lim_sw.

  • Use Find/Replace to Find Tag Name "DI_out_lim_sw".

  • Click Select All.

  • In the Replace With field, select DI-0.1.1.1 and click Replace Selected. This will assign the Hardware Tag to all occurrences of the User Tag in the project. Each occurrence in the project will now show up as DI-0.1.1.1.

  • Open Tag Database and delete the user Tag DI_out_lim_sw.

  • Next, go to Hardware Configuration or Tag Database and change the name of DI-0.1.1.1 to DI_out_lim_sw. Now each occurrence, including the Hardware Configuration, will be DI_out_lim_sw.

Using Partial Tag Name Find/Replace

When creating multiple blocks of code that are identical except for tag names, the Partial Tag Name Find/Replace feature becomes very useful.


For example, if numerous PID loops are required in your program, after the first loop is configured, copy and paste that loop into another rung. Then use the Partial Tag Name Find/Replace to rename the tags contained in the loop.


Now replace the PidLoop1 tag names in the newly created loop with PidLoop2.



After Replace Selected is chosen, the newly named tags will be created and then the selected rungs are modified to reflect the desired change.



Comment Search

The Comment Search option allows the user to search Task Comments, Rung Comments, Instruction Comments, and Tag Comments for a given “Search” string and replace it with the “Replace” string.


The following Search Filters are provided to narrow the search results:


  1. Case Sensitive: This option will cause the search string to be Case Sensitive. The search string's case (upper or lower) will be used to determine the search results.
  2. Whole Word: This option forces the software to search for complete words that match the search string.

Instruction Search

The Instruction Search option allows the user to search for an instruction in any task.

The following Filter Options are provided to narrow the search results to Ethernet, Serial, High Speed or Call instructions:

  1. Ethernet Instructions: This option will cause the search to be limited to external Ethernet based instructions (VMW, DWX, MRX, MWX, RX, and WX). The results are further limited by selecting a specific Port and IP address.

  1. Serial Instructions: This option will cause the search to be limited to Serial communication instructions (MRX, MWX, RX, WX AIN, AOUT, ACLR, CPI and CPO). The Port and Node selectors will limit the search further. The Port Selector contains all available serial ports that are not disabled.

 

  1. Call Instruction: This filter will search the program for any instances where the selected Task (chosen from the "Run When Called" category) is being called by a Call Instruction.

  1. High-Speed Instruction: This option will cause the search to be limited to High Speed instructions (HOME, REG, SMOV, SPOS, VMOV, and WHSO) . The results are further limited by selecting a Module and Channel.


Related Topics Link IconRelated Topics