|
|
Topic: P046 |
Find / Replace |
|
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.
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.
Right-click any contact or coil with a single tag and select Tag Search For... in the context menu:
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.
Note: Only Tags associated with Contacts and Coils may be searchable directly from ladder.
The Tag Search option provides the following:
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".
![]()
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.
A folder with no box next to it and no results indicates the Tag Name was not found in that area.
Expand or collapse the folders by clicking the + or - next to it.
Expand or collapse all folders by clicking the "Expand All" or "Callapse All" buttons.
Double click a search result to view the result in context.
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.
Defining which Tags to Replace:
Place a check mark next to a search result to select that instance for replacement.
To select all or no occurrences of a Tag Name, click the Select All or Select None button.
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.
- Click the Replace Selected button to Replace the Tag Name in the locations selected in the search results list.
- Once replaced, the search results for those occurrences in the list will gray out and become unavailable to indicate they are no longer valid hits for the Find Tag Name. To update the search results to reflect the current state of the project, click Search Now again.
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.
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.
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:
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:
