WinCC Unified Alarm Filter Script Removed in V18 Workaround Guide

David Krause14 min read
HMI / SCADASiemensTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

WinCC Unified Alarm Filter Script Removed in V18: Complete Workaround Guide

Siemens WinCC Unified (TIA Portal) introduced a regression in V18 where the ability to dynamize the alarm control filter through a script was silently dropped from the engineering environment. Projects migrated from V17 lose the filter script at compile time, and the script editor no longer offers the alarm control's filter property as a scriptable target. This reference documents the affected versions, the engineering-side root cause, and three field-verified workarounds that restore filter dynamization without requiring an upgrade to V19.

Field context: The regression was confirmed through Siemens technical support (request escalated to the German factory team). WinCC Unified PC Runtime V18 Update 1 Service Release 2 does NOT resolve the issue. Only the TIA Portal V18 ES (Engineering System) update or service release is expected to provide a fix in the WinCC Unified ES V18 product line.

1. Problem Details

1.1 Observed Symptom

On a WinCC Unified alarm control object (HMI tag-based alarm or controller-based alarm), the engineer previously attached a JavaScript to the Filter property in V17. After migrating the project to TIA Portal V18:

  • The filter script is no longer visible in the Events or Properties dialog of the alarm control.
  • The Filter property does not appear in the script editor's object list when attaching a script.
  • Existing V17 scripts fail to compile or are stripped during migration.
  • The filter UI in runtime is functional for static text filters, but dynamic value-based filtering no longer works.

1.2 Reproduction Sequence

  1. Create a TIA Portal V17 project with WinCC Unified PC Runtime or Unified Comfort Panel.
  2. Add a screen containing an Alarm Control object (e.g., AlarmControl_1).
  3. Right-click the Filter property of the alarm control and attach a JavaScript that returns a filter expression (e.g., return "AlarmClassName == 'AlarmHigh'";).
  4. Compile and download. The filter dynamization works in runtime.
  5. Migrate the project to TIA Portal V18 SPx (any SP level to date).
  6. Open the same alarm control. The Filter property no longer offers a script trigger.

1.3 Functional Impact

Capability V17 ES V18 ES (current) Workaround Available
Static filter text Supported Supported N/A
Filter via script trigger (alarm control Filter event) Supported NOT exposed Yes (see §5)
Filter via Screen.Items access Supported Supported Yes (see §4)
Filter via dynamizable property (item parameter) Supported Supported Yes (see §6)
Filter via Global JavaScript module Supported Supported Yes (recommended)

2. Affected Versions and Products

Product Version Affected Notes
TIA Portal (WinCC Unified ES) V17 (any SP) No (works as designed) Baseline behavior
TIA Portal (WinCC Unified ES) V18 Yes Filter scripting removed from alarm control
TIA Portal (WinCC Unified ES) V18 SP1 Yes Regression persists
TIA Portal (WinCC Unified ES) V18 Update 1 / SR2 Yes Confirmed by hotline escalation
WinCC Unified PC Runtime V18 Update 1 Service Release 2 Partial Runtime fix does NOT cover ES-side regression
WinCC Unified Comfort Panels (MTP700/1000/1200/1500/1900/2200) V18 image Yes Same ES behavior as PC Runtime
TIA Portal (WinCC Unified ES) V19 (planned) Pending fix Roadmap indicates reinstatement
Tag licensing: Projects that migrate to V18 and exceed 2,500 power tags require the appropriate WinCC Unified ES + Runtime licensing. The script regression is independent of tag count, but large alarm workloads (>5,000 active alarms) magnify the impact of losing dynamic filter scripting.

3. Root Cause Analysis

3.1 Engineering System Change

In V18, the alarm control object model was refactored. The Filter property was reclassified from a scriptable dynamization target to a static configuration property on the alarm control property sheet. The change is visible in the TIA Portal property inspector: in V17 the property shows a small lightning-bolt icon next to the Filter field, indicating a script trigger is available; in V18 that lightning-bolt icon is absent.

3.2 Why the Runtime Did Not "Break"

The runtime API for alarm control filtering was not removed. The JavaScript engine inside WinCC Unified still accepts filter assignments when the script runs in a context where it can reach the alarm control item (e.g., through Screen.Items or through a function parameter). What changed is purely the engineering-side dialog binding that previously let an engineer "wire" a script to the filter without writing code.

3.3 Object Model Reference (V18)

Property / Method Availability V18 Read/Write Notes
AlarmControl.Filter Yes (runtime API) R/W String expression evaluated by runtime
AlarmControl.FilterCriteria Yes R/W Multi-line criteria when filter builder is used
AlarmControl.ApplyFilter() Yes Method Forces re-evaluation after Filter assignment
AlarmControl.ResetFilter() Yes Method Clears active filter expression
ES dialog: "Filter" event with script trigger No N/A Removed in V18

4. Workaround A: Access via Screen.Items

The most portable workaround is to call the filter from a global JavaScript module or from a button's Click event, reaching the alarm control through the screen collection.

4.1 Step-by-Step Implementation

  1. In the TIA Portal project tree, expand WinCC Unified > Screens and select the screen that contains the alarm control (e.g., Screen_AlarmOverview).
  2. Open the Scripts node under the screen and create a new JavaScript function called ApplyAlarmFilter.
  3. Insert the function body shown below.
  4. Wire the function to a UI control (button, IO field change event, or a tag-triggered scheduled task).

4.2 Code: Global JavaScript Module

// File: Scripts\Global.js (WinCC Unified global module)
// Applies a dynamic filter expression to the alarm control on the active screen.
// Parameters:
//   screenName    : string  - Name of the screen containing the alarm control
//   alarmCtrlName : string  - Name of the alarm control object on the screen
//   filterExpr    : string  - Filter expression understood by the alarm control
// Returns:
//   boolean       - true if filter was applied, false if control not found
export function ApplyAlarmFilter(screenName, alarmCtrlName, filterExpr) {
    try {
        let screen = Screen.Items(screenName);
        if (screen === null || screen === undefined) {
            HMIRuntime.Trace("ApplyAlarmFilter: screen not found - " + screenName);
            return false;
        }
        let alarm = screen.Find(alarmCtrlName);
        if (alarm === null || alarm === undefined) {
            HMIRuntime.Trace("ApplyAlarmFilter: alarm control not found - " + alarmCtrlName);
            return false;
        }
        alarm.Filter = filterExpr;
        // Re-evaluate to ensure runtime applies the new expression
        if (typeof alarm.ApplyFilter === "function") {
            alarm.ApplyFilter();
        }
        return true;
    } catch (e) {
        HMIRuntime.Trace("ApplyAlarmFilter exception: " + e.message);
        return false;
    }
}

4.3 Code: Button Click Event Script

// Triggered by a "High Priority" push button on Screen_AlarmOverview
export function Btn_HighPriority_Click(item) {
    // Hardcoded filter expression for high-priority active alarms only
    let filter = "(Priority >= 2) AND (State = 1)";
    let screen = Screen.Items("Screen_AlarmOverview");
    let alarm  = screen.Find("AlarmControl_1");
    alarm.Filter = filter;
    alarm.ApplyFilter();
}

4.4 Filter Expression Grammar

WinCC Unified filter expressions use the same grammar as WinCC Professional. The following operators and operands are supported on the Filter property:

Operand Type Example
AlarmClassName String AlarmClassName == 'AlarmHigh'
Priority Integer 0..16 Priority >= 2
State Integer (0=inactive, 1=active, 2=acknowledged, 3=cleared) State = 1
AcknowledgementState Integer AcknowledgementState = 0
Source String (PLC tag or area) Source LIKE 'DB100.*'
EventText String EventText CONTAINS 'valve'
ModificationTime DateTime ModificationTime > '2025-01-01 00:00:00'

4.5 Verification of Workaround A

  1. Compile the project and start the runtime simulator.
  2. Click the configured button. Open the HMI trace viewer (HMIRuntime.Trace output visible in the diagnostics window).
  3. Confirm no "screen not found" or "alarm control not found" messages appear.
  4. Confirm only alarms matching the filter expression are visible in the alarm control.
  5. Toggle a priority-1 alarm in the PLC and verify it does NOT appear when filtered for priority >= 2.

5. Workaround B: Use the item Parameter from a Dynamizable Property

Where the alarm control's Filter property itself does not offer a script trigger, you can attach a script to any other scriptable property on the alarm control and use the implicit item parameter to reach the control. This works because, in WinCC Unified, any property script receives the object as the item argument by default.

5.1 Implementation

  1. Open the alarm control properties in TIA Portal V18.
  2. Select a property that still offers a script trigger (e.g., Visible, Enabled, or any custom property).
  3. Attach a JavaScript. The function signature automatically receives item representing the alarm control.
  4. Set the filter on the item reference.

5.2 Code: Filter via Visible Property Script

// Attached to the Visible property of AlarmControl_1.
// The "item" parameter is the alarm control object itself.
// Using it we can reach the filter even though the Filter
// property no longer exposes a script trigger in V18.
export function AlarmCtrl_Visible(item) {
    // Always keep the control visible
    let visible = true;

    // Dynamic filter logic that was previously bound to the Filter event
    let priorityTag = Tags("HMI_DB.FilterPriority").Read();
    let stateMask   = Tags("HMI_DB.StateMask").Read();

    let filterExpr = "Priority >= " + priorityTag + " AND State = " + stateMask;
    item.Filter = filterExpr;
    if (typeof item.ApplyFilter === "function") {
        item.ApplyFilter();
    }

    return visible;
}
Caveat: The Visible property script is invoked only when the value of the bound tag changes. If you need the filter to re-evaluate on tag change, make sure the tags used inside the function are also bound to the screen, or call this function from a tag-triggered scheduled task at a fixed interval.

5.3 Scheduled-Task Variant (1-second polling)

// Triggered every 1000 ms by a WinCC Unified scheduled task named
// "AlarmFilterRefresh". Reads the current tag values and applies the filter.
export function AlarmFilterRefresh_Tick() {
    let alarm = Screen.Items("Screen_AlarmOverview").Find("AlarmControl_1");
    let prio  = Tags("HMI_DB.FilterPriority").Read();
    let state = Tags("HMI_DB.StateMask").Read();

    alarm.Filter = "Priority >= " + prio + " AND State = " + state;
    alarm.ApplyFilter();
}

6. Workaround C: Use the Alarm Filter Criteria String Builder

For projects that only require static filter logic with a few operator-selectable conditions, the alarm control's built-in filter criteria editor remains functional in V18. This is not a script solution, but it eliminates the need for a script altogether.

  1. Open the alarm control configuration.
  2. Select the Filter tab.
  3. Click Criteria and define conditions using the dialog (e.g., Priority >= 2).
  4. Save and download. The filter is applied at runtime without any scripting.

For projects that previously used dynamic filter strings driven by tag values, this approach requires migrating logic into multiple configured filter profiles that the user selects at runtime via FilterCriteria property (R/W).

7. Migrating V17 Scripts to V18: Step-by-Step

Use the following migration checklist when porting an existing V17 alarm filter script to a V18 project.

  1. Inventory the existing scripts. In V17, export the script library and document each alarm control that uses filter scripting. Note the alarm control name, screen, and the filter expression source (tags, constants).
  2. Decide on the workaround strategy:
    • If the filter expression depends on runtime tags that change frequently, use Workaround B (item parameter) with a scheduled task or tag trigger.
    • If the filter expression is set only on user actions (button presses), use Workaround A (Screen.Items).
    • If the filter expression is essentially static, use Workaround C (built-in criteria).
  3. Refactor the function signature to receive an item or screenName/alarmCtrlName argument. Do not rely on implicit ES-side binding to the alarm control.
  4. Validate filter grammar against the table in §4.4. Note that = for comparison (not ==) is the WinCC filter idiom in both V17 and V18, although == is also accepted.
  5. Add exception handling around every alarm.Filter = assignment. A null reference will throw a runtime error visible in the HMI diagnostics window.
  6. Compile and run the simulator before downloading to a panel. The simulator respects HMIRuntime.Trace and surfaces null-reference exceptions in the log.
  7. Document the workaround in the project README so future engineers understand why the script is not bound to the alarm control's Filter property in the ES.

8. Performance and Trace Considerations

Pattern CPU Impact (per alarm control) Recommended Use
Filter reassignment on every tag change High (rebuilds filter criteria) Avoid when alarm count > 5,000
Filter reassignment on user button click Negligible Preferred for dynamic user-driven filters
Filter via scheduled 1-second tick Low Acceptable for plant-level filtering
Filter via scheduled 100 ms tick Moderate Use only when < 500 active alarms
Multiple alarm controls each calling ApplyFilter() Compounds (linear) Group controls and share filter logic
Trace tip: Always wrap filter assignment code in a try/catch and emit HMIRuntime.Trace with the alarm control name and filter expression. This dramatically shortens commissioning time when the screen path differs between the engineering tree and the runtime.

9. V19 Roadmap and Siemens Support Path

According to Siemens technical support escalation feedback, the alarm control filter scripting capability is expected to be reinstated in TIA Portal V19. Until V18 ES receives an update that restores the dialog-level binding, the workarounds in §4 and §5 are the only supported paths.

To track the official fix:

  1. Visit the Siemens Industry Online Support entry referenced in the V18 release notes: TIA Portal V18 Update 1 release notes (Siemens Support entry 109807123).
  2. Search the Siemens Support database for "WinCC Unified alarm control filter script" and subscribe to the entry. New updates trigger an email.
  3. Open a support request (Siemens ID required) referencing the V18 regression and request notification when V18 ES or V19 ES restores the feature.

10. Verification Checklist Before Going Live

Check Pass Criteria
Filter expression visible in HMI trace Trace line shows alarm.Filter = '...'
ApplyFilter() invocation No "ApplyFilter is not a function" error
Alarm control name resolution screen.Find(name) returns non-null
Filter result in runtime Only matching alarms visible after filter applied
Priority boundary test Switching priority tag from 1 to 3 changes visible alarms
Reset capability Calling alarm.ResetFilter() restores all alarms
Multi-screen navigation Filter persists or resets as designed across screen changes
Memory growth Runtime memory stable after 1 hour of repeated filter changes
Trace exceptions No uncaught exceptions in HMI diagnostics
UDT compatibility Filter referencing UDT struct members compiles and runs

11. Symptom-to-Workaround Matrix

Symptom Most Likely Cause Recommended Action
Script trigger icon missing on Filter property V18 ES regression Apply Workaround A or B
Existing V17 script disappears after migration V18 ES strips unrecognized bindings Re-author script using Screen.Items
Runtime: "Property Filter is read-only" error Wrong object type accessed (e.g., screen instead of control) Verify with screen.Find()
Filter expression accepted but no alarms shown Filter grammar mismatch (e.g., single '=' instead of '==') Validate against §4.4 grammar
Filter changes work in simulator, fail on panel Scheduled task not downloaded to panel Re-download full runtime project
UDT struct member not recognized in filter V17 limitation; resolved in V18 Use V18 UDT-based filter expressions
Filter applies once, does not refresh on tag change Trigger attached to non-changing event Switch to scheduled-task or tag-change trigger
Multiple alarm controls, only one filtered Function targets hardcoded name Parameterize alarm control name

12. Related Siemens Documentation References

Why did my alarm filter script disappear after migrating from WinCC Unified V17 to V18?

Siemens refactored the alarm control object model in TIA Portal V18. The Filter property was reclassified from a scriptable dynamization target to a static configuration property on the property sheet. Existing V17 scripts are stripped during migration. The runtime API still supports filter assignment; only the engineering-side binding is missing. Use a global JavaScript module that reaches the alarm control via Screen.Items.Find() or attach a script to any scriptable property and use the implicit item parameter.

Does WinCC Unified PC Runtime V18 Update 1 SR2 fix the alarm filter script regression?

No. Confirmed by Siemens hotline escalation. The Update 1 SR2 is a runtime patch only; it does not modify the engineering system (WinCC Unified ES V18) where the script trigger was removed. An ES-side update or service release for TIA Portal V18 is required to restore the dialog-level binding. Until then, the workarounds in this guide are the only supported approaches.

Will V19 restore alarm filter scripting in WinCC Unified?

Per Siemens technical support feedback, the alarm control filter scripting capability is expected to be reinstated in TIA Portal V19. Subscribe to Siemens Support entry 109807123 to receive notification when the official fix is published. Engineers currently on V18 should plan the workaround strategy documented here as the production path.

Can I reference UDT struct members in the alarm filter expression in V18?

Yes. UDT-based filter expressions are supported in WinCC Unified V18 (they were not supported in V17). Use the UDT member path in the filter, e.g., Source LIKE 'DB100.MyUDT.Member1' or filter on a UDT-derived alarm class. Make sure the UDT is instantiated in the PLC and visible to the HMI tag table before referencing it in the filter expression.

What is the syntax to apply a filter programmatically in WinCC Unified V18?

Use the following pattern inside a global JavaScript module or button event: let alarm = Screen.Items("ScreenName").Find("AlarmControl_1"); alarm.Filter = "Priority >= 2"; alarm.ApplyFilter();. The ApplyFilter() call forces the runtime to re-evaluate the expression. Without it, the filter may not be reflected until the next data update cycle.

Back to blog