IMDTouchKnowledge BaseShop main store

Troubleshooting

WinCC Unified Faceplate Global Definition Area Scripts

HMI and touchscreens Published 5 min read By IMDTouch engineering team

Short answer

The faceplate Global Definition Area in WinCC Unified holds variable initialization and user-defined function definitions only. Tag calls such as Tags("Status").Read() do not execute there, so run the read from a property or event script and pass the value into functions defined globally.

On this page
  1. What can the Global Definition Area of a faceplate hold?
  2. Why does my tag read in the Global Definition Area do nothing?
  3. How do I share one status word between several faceplate animations?
  4. How do I read a UDT tag linked through the faceplate interface?
  5. Do globally defined variables stay visible across all script contexts?
  6. How do I verify the whole arrangement on the bench?
  7. Questions asked

Put shared state and reusable functions in the faceplate Global Definition Area, but keep every tag read and write in a local property or event script. Testing on a TIA Portal V17 faceplate showed that even a minimal Tags("Status").Read() call does nothing when placed in the Global Definition Area, so the area is a declaration space, not an execution space. This article gives the working pattern for a status word that drives several animations, with the verification steps to run at runtime.

What can the Global Definition Area of a faceplate hold? #

It holds variable initialization and user-defined function definitions, and nothing that executes on its own. All definitions there are shared between every instance of the faceplate type, so a value you initialize once is visible to the scripts that reference it, per Siemens' documentation on dynamizing a faceplate type.

That makes the area the right home for three things:

  • Initialized state, for example Boolean flags set to false that later carry bit results
  • Parameterized functions, for example a bit-stripping function that fills those flags from one word
  • Constants the faceplate's scripts reuse, such as mask values

It is the wrong home for tag traffic. A call like Tags("Status").Read() placed there is never executed, which is exactly why it fails silently rather than throwing an error.

Why does my tag read in the Global Definition Area do nothing? #

Because tag access is not supported in that area at all. The V17 testing behind this finding was plain: initialize a variable there and it works, define a function there and it can be called, but a Tags(...).Read() line placed directly in the area never runs, and the compiler reports no error to tell you why.

The failure is silent because the JavaScript compiler in the faceplate editor does not check references or function calls strictly. A mistyped function name or an unsupported call compiles without complaint and simply has no effect at runtime. Never rely on a clean compile as evidence that a faceplate script works; only a runtime test proves it.

How do I share one status word between several faceplate animations? #

Use a three-part pattern: global Booleans and a function in the Global Definition Area, one read script that feeds them, and animations that consume them. The read script runs wherever a tag change can trigger it, and the function turns one word into individual bits the animations can bind to.

  1. Link the status tag to the faceplate interface, for example an interface item named Status of type Word.
  2. In the Global Definition Area, initialize the Booleans you need, for example bit0 = false, bit2 = false, bit4 = false.
  3. In the same area, define a function, say Bitstrip(value), that sets those Booleans from the parameter.
  4. On a faceplate property that reacts to a change of Status, run Tags("Status").Read() and pass the result into Bitstrip.
  5. Bind each animation to its Boolean through a local script.

Worked example: the read returns the status word 16#0015, which is 21 in decimal and 0000000000010101 in binary. Bitstrip masks it and finds bit 0 set (21 AND 1 = 1), bit 2 set (21 AND 4 = 4) and bit 4 set (21 AND 16 = 16), so bit0, bit2 and bit4 become true and every other flag stays false. All animations bound to those three flags update from this one read; without the pattern you would repeat the same masking logic in each animation script.

How do I read a UDT tag linked through the faceplate interface? #

Call it in script by the name you gave it in the faceplate interface, not by its PLC name. If interface item MyUDT1 is a tag link to a library UDT containing two DWORDs named STAT and CMD, your scripts address those members through the interface name inside any local faceplate script.

This is the cleanest data path into a faceplate, and it needs no Global Definition Area involvement. Read it in the local script that also calls your global function, so the interface delivers the value and the Global Definition Area only processes it. If you cannot tell whether a value on screen comes from the tag, the binding or the script, work through the diagnosis of HMI value faults before changing code.

Do globally defined variables stay visible across all script contexts? #

Within one context, yes; across contexts, verify it yourself. One reported test confirmed a globally defined reference usable in the event scripts of multiple screen items, and another implementation drove several animation scripts from the same globally initialized Booleans, which is consistent with Siemens' statement that global definitions are shared by all instances of the faceplate type.

Property scripts and event scripts should still be treated as separate cases until a bench test shows both reacting. The verification is short: change individual bits in the source status word at runtime and watch every context that consumes the Booleans, one context at a time.

How do I verify the whole arrangement on the bench? #

Prove it with forced tag changes, not with the compiler. Because wrong references produce no useful build errors in the reported V17 environment, the runtime test is the only evidence, and it takes a handful of steps:

  • Write a known pattern to the status word, for example 16#0015, and confirm exactly the expected Booleans go true.
  • Toggle each bit of the source word separately and confirm the matching animation follows and no others do.
  • Repeat the bit-toggle test for every property and event context that consumes the variables.
  • Deliberately mistype one function call in a scratch script and confirm the compiler stays silent, so you know why the bench test matters.

If a context does not react, move its read into that context as a local script rather than hunting for a global fix. If a shared definition turns out not to carry into a context on your build, the fallback is the one the pattern already uses: repeat the small amount of state locally where it is needed.

Questions asked

Can variables defined in a faceplate Global Definition Area be seen by every script in the faceplate?

Within one script context they can. Testing on a V17 faceplate showed a globally defined tag reference resolving in the event scripts of several screen items, and an attached example project reused the same global variables across multiple local scripts. Treat property and event contexts as separate until you have changed the tag at runtime and watched both react.

Why does the JavaScript compiler not complain about a wrong reference or function name?

The faceplate compiler is weak on reference checking, so a mistyped function name or a tag call in a place where it cannot run produces no build error and simply does nothing. Prove every reference by changing the source tag at runtime on a bench and watching the animations, not by trusting the compiler output.

Is there a way to run global module functions inside a faceplate?

No. Global script modules cannot be imported into a faceplate type, so functions from those modules are not callable from faceplate scripts. The workarounds that exist are local: define the function in the faceplate's own Global Definition Area, or trigger a scheduled task or a hidden I/O field event from an interface tag.

What is the difference between this and a Comfort panel global tag?

On a Comfort panel you could define a tag once globally and dynamize with it across screens. A Unified faceplate has no equivalent execution-level global tag: the Global Definition Area holds data and functions but performs no tag traffic, and each faceplate instance shares only the definitions, so reads stay in local scripts.

Keep reading

  • Explainer

    Why a WinCC Unified Faceplate Interface Has No Static Value Choice

    The WinCC Unified faceplate interface offers no static-versus-tag choice: the field takes a tag connection. Pass your constant through a WString or ULInt interface property and apply it in a script on the faceplate's Loaded event, or hold the constants as tags in a PLC data-block array and pass the selected tag.

    HMI and touchscreens

  • How-to

    Bulk Rename WinCC Tags Used in a Screen

    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.

    HMI and touchscreens

  • Troubleshooting

    Why a WinCC Unified faceplate rejects a UDT with an array

    The faceplate rejects the UDT because its lowest configured device version is still V16.0.0.0, which predates array support in faceplate interface tags. Discard unpublished changes on the faceplate type, run Upgrade Device Version to set V17.0.0.0 or higher, recompile and rebind, and the array is accepted. Panel firmware and TIA Portal version play no part in this check.

    HMI and touchscreens

Where a FactoryTalk View ME Parameter File Links to a Faceplate