Project Search
What it does
Project Search finds text inside the blocks of the open TIA Portal project, whether it is connected through TIA Portal or opened offline from disk. Type a word, a variable name or an expression and the search looks through the content of every OB, FB, FC, DB, PLC data type (UDT) and PLC tag table, including items inside Software Units. Tag tables are searched across tag names, data types, addresses, comments and user constants. Every match is listed with its line and can be opened directly.
Use it to answer questions like:
- "Where is the variable
tempSegmentValueused anywhere in the project?" - "Which blocks declare an input called
enable?" - "Where does the code compare against
T#500MS?"
This complements the other lookups: Quick Open (F7) finds blocks by name, Find in Project lists cross-references of one block, and Project Search is the only one that searches the text content of the blocks.
How to open it
| Trigger | Action |
|---|---|
| Activity bar | Click the Project Search icon (the magnifier with a wavy line) |
| View menu | Choose Project Search |
| Command palette | Run Project Search |
The Project Search page opens straight away in the editor area and leaves the Side Bar as it is: when the project tree is showing, it stays visible next to the search. Selecting the icon again brings the open page back to the front.
The search works for a project connected through TIA Portal and for a project opened offline from disk. Without an open project, the page shows "Connect to a TIA project to search the content of its blocks." with a Connect button, and Search is unavailable until a project is open.
Running a search
Type the search text and press Enter or click Search. Three toggles inside the search box refine the query:
- Match Case compares upper and lower case exactly.
- Match Whole Word finds the text only as a complete word.
- Use Regular Expression treats the text as a regular expression.
The first search prepares the project sources and can take a moment. While it runs, a progress display with a counter over all items and the elapsed time is shown next to the project tree and in the status bar, both offer Cancel. Repeat searches only pick up blocks that changed since the last search and are fast. The prepared sources stay with the project after you close Studio: the first search of a new session only checks which blocks changed in the meantime.
Filtering, before and after the search
Two rows of filters, each chip shows how many results it stands for:
- Type: OB, FB, FC, DB, UDT, Tags. Click a chip to show only those items, click again to release it.
- Interface or Code: Interface keeps matches in a block's declaration section, the variable declarations before
BEGIN(VAR_INPUT,VAR_OUTPUT,VAR,VAR_TEMP, constants). Code keeps matches in the implementation afterBEGIN. Data blocks, PLC data types and tag tables count entirely as interface.
The type chips can also be picked before pressing Search: then only the selected types are prepared, which makes the search faster. If you activate additional types after a narrowed search, a hint asks you to press Search again to include them.
So a search for a variable name with the Interface chip active answers "where is it declared", and with the Code chip active "where is it used in logic".
Reading the results
Results group per block: a block row with the block's icon, type, project path and match count, and below it one row per match with the line number, an Interface or Code tag and the matched line with the hit highlighted.
After a search the blocks are collapsed, so the list reads as an overview. Click a block row (or press Enter on it) to expand or collapse it; the two buttons at the right end of the filter row expand or collapse all blocks at once. Click a match (or press Enter) to open the block with the matched line selected; a match in a tag table opens that tag table.
A right click on a result offers more: Open, Open to the Side, Reveal in Project Explorer, copying the line, name or path, and Remove from Results to clear entries you have already handled (the next search brings everything back).
Replacing across the project
The small arrow on the left of the search box opens a Replace line, turning the page into project-wide search and replace. Replacing needs the Pro plan. Type the search text, the replacement, and run the search. Then choose your pace:
- Replace All changes every shown match at once. A confirmation summarizes how many matches in how many blocks will change; the changed blocks are imported into the TIA Portal project and compiled, and the search runs again so you see what is left. The filters apply: only the matches currently shown are replaced.
- Match by match: the arrow buttons in the Replace line jump to the previous or next match, each jump selects it in the list and shows the block beside the search at that line. The Replace button changes the current match and moves on to the next, so you can work through the whole list by clicking Replace repeatedly. The same works per result row: hover a match and click its replace icon (also in the right-click menu, along with Replace All in Block). The block opens next to the search results with the replacement already in place and selected, so you can review it, undo it, or keep editing; nothing changes in the project until you save the block, and saving imports it just like any other block edit.
If a block changed in TIA Portal since the search, its matches are skipped with a note; run the search again to refresh them. Matches in tag tables and read-only blocks cannot be replaced. Replace All also skips matches in fail-safe PLC data types and names them in its confirmation; replace them one match at a time instead: the replacement goes into the opened source document, and saving it needs the login to the safety program, like any other change to a fail-safe data type. With Use Regular Expression active, $1-style group references work in the replacement.
Notes
- Graphical blocks (LAD, FBD, GRAPH) are searched through their text form on TIA Portal V20 and newer; clicking such a match opens the block in that text form at the line. On older TIA Portal versions these blocks are not text-searched and are still found by name via Quick Open.
- Tag tables are read fresh on every search, so changes made in TIA Portal are always picked up; deselect the Tags chip when you do not need them and want the fastest repeat search.
- Know-how-protected blocks are not searched.
- A fail-safe PLC data type is searched through its source text on TIA Portal V20 and newer while Open UDTs as .udt is on in the editor settings; clicking such a hit opens it for editing at the matching line, like any other data type, and saving works as it does when the type is opened from the Project Explorer. With the option off, on older TIA Portal versions, in a project opened offline, or for a data type inside a software unit, it is searched in its XML form and a hit opens it read-only at the matching line.
- A project opened offline from disk is searched as well. Its blocks are searched as text; data blocks, PLC data types and tag tables are searched in the XML form the editor shows for them, and a hit opens that form at the matching line. Graphical blocks (LAD, FBD, GRAPH) are not text-searched in a project opened offline.
- Replacing in a project opened offline keeps the changed blocks for the current session; export them or save them as files to keep the changes.
- Searching is included from the Basic plan; replacing needs the Pro plan.