IMDTouchKnowledge BaseShop main store

How-to

Bulk Rename WinCC Tags Used in a Screen

HMI and touchscreens Published 6 min read By IMDTouch engineering team

Short answer

Graphics Designer's Tag Connections dialog rewrites direct tag links and dynamic dialogs on the open picture, and it also rewrites VBS and C script names once the tag definition region is open. Because Replace With must hold at least one character, sweep prefixes in a Replace All or repoint each tag to a flat tag created in Tag Management, one replacement per tag.

On this page
  1. What the Tag Connections dialog covers
  2. Renaming the tags on a picture, step by step
  3. Working around the empty Replace With field
  4. Worked example: stripping the S7$Program(1)/HMI1. prefix from 100 tags
  5. Verify before you delete the old tags
  6. Questions asked

You can rewrite every tag reference in a WinCC 7.x picture from Graphics Designer. Edit > Linking > Tag Connections bulk-replaces the direct tag links and dynamic dialog entries on a picture, and once the tag definition region is open, the same dialog also replaces the quoted tag names inside VBS and C actions. One constraint shapes the whole job: the substitution is a literal string swap and Replace With must hold at least one character, so no pass can delete a prefix. When the new names keep a prefix, sweep the old one out with Replace All; when they must end bare, create the flat tags in Tag Management and repoint each old tag with one full-name replacement. The dialog walks only the picture that is open, so repeat the run per picture.

What the Tag Connections dialog covers #

All of this happens in Graphics Designer, and the dialog walks only the objects on the picture that is currently active. Each row shows the object, the property and the current configuration, so you can see exactly what a Replace will touch before you click it. Not every reference surface in the project is reachable from it; the table is the map. If your session on the piping screen also touches graphics, the picture's symbols live in their own library — where to find the symbol library in WinCC Graphics Designer is the companion lookup.

Reference surface What rewrites it
Direct tag link on a property Tag Connections dialog
Dynamic dialog configuration on a property Tag Connections dialog
Quoted tag name in a VBS action Tag Connections dialog, only with the tag definition region open
Quoted tag name in a C action Tag Connections dialog, only with the tag definition region open
Project-wide script in the Global Script editor By hand, in that editor
Binding in the alarm or tag logging editor By hand, in that editor

Substitution matches literal characters with no wildcards, which is why the delimiter rule in the worked example below matters.

Renaming the tags on a picture, step by step #

A missed reference on a running plant is an operator screen that silently stops showing a valve position or an alarm state, so work from a backup and verify in Runtime before the picture goes back into service.

  1. Take a project backup in WinCC Explorer immediately before the first pass.
  2. Open the target picture in Graphics Designer.
  3. Switch on the tag definition region from the View menu. Only with the region open does the Tag Connections dialog also change tag names inside VBS and C actions; with it closed, every script reference survives the pass untouched.
  4. Open Edit > Linking > Tag Connections.
  5. Type the search string into Find and the new tag name into Replace With, read the resulting name in Preview, then click Replace for the selected row or Replace All for every row matching Find.
  6. Save the picture, then repeat from step 2 for the next picture.

Why step 3 matters: a VBS action holds its tag name as a quoted literal inside the script code, and a C action does the same in C syntax. The replacement only reaches those literals when the region is open; otherwise the script keeps calling a name that no longer resolves after the cleanup. For where the limits of that scripting layer sit, see what Visual Basic can and cannot do inside a WinCC project.

Working around the empty Replace With field #

The Preview and Replace buttons stay inactive until Replace With holds something, and a single space does not rescue the run. Nothing in this dialog deletes characters, so every plan has to end in replacements whose right-hand side is a real string. Three paths cover the cases:

  • The new names keep a prefix. Find the old prefix with its trailing dot and Replace All straight to the new prefix. The dot is the delimiter that keeps the pattern off look-alike names: matching is substring work, so a Find of TagA with a Replace With of TagB also rewrites TagAB into TagBB.
  • Several old prefixes must collapse into one new prefix. Sweep each old prefix to a marker that appears in no real tag name, such as TEMP_, confirm the row count after each pass, then sweep TEMP_ to the final prefix in a last pass. The two-pass shape exists because the dialog refuses an empty Replace With; note it still cannot land on a bare name, because the final pass needs a non-empty replacement too. The staged-marker pattern is not WinCC specific: engineers doing the same prefix cleanup in LabVIEW configure it through VI Scripting, as described in the guide to LabVIEW prefix renaming with VI Scripting.
  • The names must end bare. Create the flat tags in Tag Management with the same data type and connection parameters as the originals, then repoint per tag: Find the full old name, Replace With the flat name, Replace. Both sides are non-empty, so the dialog accepts every pair. Each tag needs its own pair because there are no wildcards, and the old prefixed tags are deleted only after the verification below.

Worked example: stripping the S7$Program(1)/HMI1. prefix from 100 tags #

Inputs: a WinCC 7.3 piping diagram with 100 tag references spread across direct connections, dynamic dialogs, VBS actions and C actions — the case that prompts this article; old names of the form S7$Program(1)/HMI1.In_YS23, where the prefix S7$Program(1)/HMI1. is 19 characters; flat targets such as In_YS23 at 7 characters and In_YS200 at 8; and the dialog rules above (literal substitution, no wildcards, the non-empty Replace With field).

Rule in words: because nothing can be deleted in-dialog, the bare-name target is reached by creating the flat tags in Tag Management first and swapping each full old name for its flat name in one non-empty replacement per tag.

Arithmetic:

  • Prefix length: S7$Program(1) is 13 characters, plus the slash (1), HMI1 (4) and the dot (1): 13 + 1 + 4 + 1 = 19 characters.
  • Full old name: 19 + 7 = 26 characters for In_YS23, and 19 + 8 = 27 characters for In_YS200.
  • Delimiter check: a look-alike such as S7$Program(1)/HMI12.Valve holds the digit 2 at position 19 where the pattern requires the dot, so the 19-character Find string cannot catch it.
  • Operation count: 100 tags at one replacement each gives 100 replacements in the dialog, then one cleanup pass that deletes the 100 retired tags in Tag Management. Had the target kept a prefix — PL1_, say — a single Replace All of the 19-character prefix to the 4-character PL1_ would rewrite every row in one operation, turning each 26-character name into an 11-character PL1_In_YS23.

Result: every reference on the picture, scripts included because the tag definition region was open during the pass, resolves to the flat tags, and the retired prefixed tags are removed from Tag Management.

Decision: for a bare target, create the flat tags first, budget one replacement per tag, and delete the old tags last; for a prefixed target, one Replace All with the trailing dot in Find; for several old prefixes, stage the pass through TEMP_. The acceptance threshold either way: search Find for the old prefix afterwards and accept nothing but zero rows, because a surviving row is a dead element at runtime.

Verify before you delete the old tags #

  • Reopen Edit > Linking > Tag Connections with the tag definition region still open and search Find for the old prefix; the expected count is zero rows.
  • Save and close the picture, then run the same check on every other picture that referenced the old names.
  • Activate the project and operate each renamed element once in Runtime, watching that every value actually moves.
  • Delete the old prefixed tags from Tag Management only after those checks pass.

Questions asked

Does this dialog work the same in WinCC 7.4 and 7.5?

Yes. The vendor documents the feature again for WinCC V7.5 SP2, where the Edit menu entry is named Linking / Tag Connection and the dialog itself is titled Linking of the Tag Connection. The behavior is unchanged across the 7.x line: the substitution is literal, and Replace With must hold at least one character before Preview and Replace become active.

Can I do the rename without stopping the running project?

The picture rewrites happen in Graphics Designer, and the WinCC documentation states that tags, tag groups and structures can be edited in Runtime while the project is activated. You can therefore create the flat replacement tags without a stop, then run the picture edits and the verification in a maintenance window.

What happens to a reference the replacements miss?

It keeps the old name and still works against the old tag until you delete that tag in the cleanup pass; from that moment the direct link or dynamic dialog points at a name that no longer exists, the object freezes on its last value, and a VBS or C action errors the first time the action runs. The zero-row search before deletion is what catches it.

Can a Replace be undone?

Not from the dialog. A replacement is committed as soon as you click Replace or Replace All, and there is no undo step to fall back on. The project backup taken immediately before the first pass is the way back, so take it at the last moment before you start, and rehearse a heavily used picture on a copy of the project first.

Keep reading

  • Troubleshooting

    Why WinCC Unified screen titles mix up between clients

    The mixed titles come from one shared internal tag: every client session reads and writes the same stored value, so the last client to change screens sets the title everywhere. Set the tag's Scope to Local session in the HMI tag table, load the project and start fresh sessions; each client then keeps its own title. Keep shared scope only for values that describe the plant rather than the viewer.

    HMI and touchscreens

  • Troubleshooting

    Why a WinCC VBScript table screen takes 20 seconds to open

    The opening is slow because each scripted field reads its characters one tag at a time: 18 rows × 10 fields × about 8 reads = 1,440 individual tag operations. Group the reads into one call where the runtime offers grouped access, or compose the strings in the PLC; rescheduling the same loops never fixes it.

    HMI and touchscreens

  • Troubleshooting

    Why MTP1500 CSV log export needs a script in TIA V20

    On an MTP1500 engineered in TIA Portal V20 there is no ExportTagLog system function and no Comfort-style CloseAllLogs/ArchiveLogFile/OpenAllLogs sequence, because Unified logs are SQLite segments, not TXT or CSV files. The documented route is the supplied snippet under Snippets > HMI Runtime > Tag Logging > Export Tag Log as CSV, sequenced with status tags so logging stays open and no samples are lost.

    HMI and touchscreens

Why WinCC Unified screen windows replace template screens