skip to main content
RiverWare Policy Language (RPL) : RPL User Interface : RPL Search and Replace Dialog
RPL Search and Replace Dialog
The RPL search and replace dialog supports flexible replacement of strings within a single RPL set or all RPL sets. Within this dialog, you can search for all occurrences of a string and replace all or some of them with another string.
Accessing the Dialog
The RPL search and replace dialog is accessible in the following ways:
• From the main workspace, select Policy, then RPL Search and Replace
• Selecting Search and Replace from the Edit menu of the RPL editor and its children dialogs (the RPL Set, Function, and Rule/Method editors) or from the RPL Set analysis dialog.
• Pressing the F4 key from any of the RPL editors or the analysis dialog.
• Right-clicking when editing any RPL expression and selecting Search and Replace from the resulting popup menu.
Searching for Occurrences of a String
To search for occurrences of a string, begin by typing the search string into Search for: field and then either hit Enter or select the Search button.
When you initiate a search, the search string is added to a history of searches. To re-select a previous string, select the triangle just to the right of the search string. This will present a menu containing previous search strings, allowing you to select one as the current search string.
Exactly where and how a search is conducted can be controlled by selecting various options.
• Case sensitive. When checked, RiverWare searches for strings which match the search string exactly, otherwise it will ignore case.
• Look in Names. When checked, RiverWare tries to match occurrences of the string within the names of RPL items in the set. This includes the names of the RPL set and its contained groups, rules/methods, and functions.
• Look in Expressions. When checked, RiverWare tries to match occurrences of the string within all expressions in the RPL set. Eligible sub-expressions within an expression include values of type DATETIME, NUMERIC, BOOLEAN, STRING, OBJECT, and SLOT, as well as function calls (the name of the function being called is eligible for a match)
• Look in Descriptions. When checked, the contents of all descriptions (set, group, and rule/method) are searched for matching strings.
• Look in Notes. When checked, the contents of all notes (set, group, and rule/method) are searched for matching strings.
• Search in. If the dialog is accessed from the workspace Policy menu, it starts with All RPL Sets selected. Otherwise it will be configured to search in the RPL set corresponding to the dialog through which it was accessed. The name of the set selected will be displayed in a box to the right of the Search button. You may switch from this set to any other open set or to all sets by selecting the set name and choosing a new set (or all sets) from the menu.
Note:  When you search in the Expression Slot Functions Set (or All RPL Sets), the expression slot expressions (i.e. the RPL expressions shown on the expression slot dialog) are searched along with the functions in the Expression Slot Functions Set. In this case, the parent is the object containing the expression slot.
The results of the search are displayed in the Search results table which contains one row for each string that matches the search string. Each row displays the name of the item containing the string (a set, function, group, rule/method, or expression slot) as well as where within that item the matching string was found (the object name, description, or one of its expressions). In the case of a match within an expression, the actually matching sub expression is also displayed.
Note:  A search string can match multiple times within a given item. For example, when searching for the string “res”, a rule named “Forrest Reservoir Flood” will match twice.
Double-clicking a row of the Search results table will open an editor for the item containing the matching string corresponding to that row. If the match is within an expression, the matching sub-expression will be the selected expression in the editor and the dialog will be scrolled to that expression. Use the Previous Item and Next Item buttons to step through matches and opening/scrolling the dialog containing the match.
Tip:  If you want to change the name of a function argument or looping variable (within a FOR or WITH), select the variable and use the right-click Rename menu. This utility will rename all instances of that variable within the expression or function. See Renaming Looping Variables and Function Arguments for details on this utility.
Replacing Matching Strings With Another String
Once a search has been conducted, one can replace all or some of the matching strings with another string. First, type the replacement string into the field labeled Replace with:. To replace all of the occurrences then select the Replace All button. To replace only some of the matching strings, select those that you wish to replace in the Search results list (click selects a single row, Ctrl-click allows multiple independent selections, Shift-click selects a range of contiguous rows), then select the Replace Selected Occurrences button.
Revised: 08/02/2021