Overview
WinCC 7.0 SP3 does not expose first-class array tag structures to the HMI Graphics Designer runtime. When a single ComboBox selection must drive a different set of I/O field values (for example, 10 parameter values per car brand across 30 cars), the only practical solution inside the standard VBScript API is to lay out a flat tag namespace of N × M tags and switch either visibility or contents via a VBScript action fired by the ComboBox selection event.
This reference documents the 30 cars × 10 fields = 300 tag layout that arises from this constraint, the VBScript read/write pattern using HMIRuntime.Tags and ScreenItems, an optimized 10-field reusable variant, and the verification checks that prove the picture behaves correctly at runtime. The patterns are valid for WinCC V7.0 SP3 through V7.5 SP2 because the runtime VBScript API has remained compatible across these versions.
Architecture Constraints
WinCC V7.0 SP3 (and V7.2 / V7.4 / V7.5 that share the same runtime API) presents three constraints that drive the design:
- No first-class array tags. Tag names are scalar in the Graphics Designer, even when the underlying PLC connection is a structured S7-1500 / S7-1200 tag surfaced through OPC UA. Classic WinCC with the SIMATIC S7 Protocol Suite exposes only flat tag names.
-
Object addressing by name. Picture objects are referenced through
ScreenItems("Name"), requiring a unique static object name per I/O field, StaticText, or ComboBox item. - Event-driven VBScript. The ComboBox exposes a standard selection-changed event (in WinCC 7.x the configuration event is "OnPropertyChange" on the object or "OpenPicture" on the picture). The VBScript is bound to that event under Graphics Designer → Properties → Events.
Together these three rules lead to a fully expanded tag layout. The article presents two layouts: a 300-tag fully visible set, and a 30-tag reusable set that swaps the contents of 10 I/O fields on every selection.
Tag Layout
For 30 cars × 10 parameter values, declare 300 process tags in the WinCC Tag Management. The recommended naming convention is Var<P>Car<C> where <P> is the parameter index 1-10 and <C> is the car index 1-30.
| Prefix | Index | Range | Count |
|---|---|---|---|
| Var | Parameter | 1-10 | 10 per car |
| Car | Car | 1-30 | 30 entries |
| Total process tags | 300 | ||
| Plus: ComboBox Output Value tag | 1 (e.g. SelectedCarIndex) |
||
| Plus: Optional car list / header label | 1 (e.g. CarList) |
||
Examples of tag names:
-
Var1Car1- parameter 1, car 1 (Fiat default in the source case) -
Var10Car30- parameter 10, car 30 -
Var5Car15- parameter 5, car 15
Each tag can be a WinCC internal tag, a SIMATIC S7 tag, or an OPC UA node. With the SIMATIC S7 Protocol Suite the typical structure on the PLC side is one DB with 300 words: DB100.DBW0 through DB100.DBW598 (300 × 2 bytes). That is a hardware/PLC-side decision and not a WinCC requirement.
ComboBox Configuration
Insert a ComboBox object from the Graphics Designer "Standard Objects" palette and name it ComboBoxCars. Populate it with the 30 car names. The typical property bindings on WinCC 7.0 SP3 are:
-
List: hard-coded 30 entries separated by semicolons (e.g.
Fiat;Mercedes;Volkswagen;Audi;...) or bound to a WinCC TextList. -
Output Value: bound to an internal INT tag
SelectedCarIndex(range 0-29). - Selection Index: the runtime pointer; reflects the active item.
On WinCC 7.3 and later the Smart-Script wizard can be used to bind the event automatically; on WinCC 7.0 SP3 the manual VBScript binding is the standard workflow described in the WinCC Information System under "Working with WinCC → VBS for Creating Procedures and Actions".
Naïve Implementation: 300 I/O Fields with Visibility Toggle
The straightforward approach is to lay out 300 I/O fields (10 rows × 30 columns, or grouped per car) and use a VBScript action that hides the inactive car group and shows the active one.
VBScript: ComboBox Selection-Changed Action
' ---------------------------------------------------------------------------
' ComboBoxCars - Event: OnPropertyChange (or SelectionChanged on WinCC 7.3+)
' Hides all I/O fields for non-selected cars; shows fields for selected car.
' ---------------------------------------------------------------------------
Option Explicit
Dim i, j
Dim oField
Dim carIndex
' Map ComboBox selection index (0-29) to car index (1-30)
carIndex = SmartTags("SelectedCarIndex") + 1
' Guard against bad selection value (defensive)
If carIndex < 1 Or carIndex > 30 Then
carIndex = 1
End If
' Iterate over 30 cars and 10 fields, toggle Visible property
For i = 1 To 30
For j = 1 To 10
On Error Resume Next
Set oField = ScreenItems("IOField" & j & "Car" & i)
If Err.Number = 0 Then
oField.Visible = (i = carIndex)
End If
On Error Goto 0
Next
Next
This script iterates 300 times. On a typical WinCC 7.0 SP3 picture at 1 ms cycle the toggle completes in < 5 ms. The performance cost is acceptable for a single selection event, but the 300 I/O fields themselves consume picture memory and editor load time, which is the reason the optimized layout in the next section is preferred for new projects.
VBScript: Read 10 Tags for One Car and Write to I/O Fields
To populate a single set of 10 I/O fields, read the 10 tags for the selected car and assign them to the field Text property:
' ---------------------------------------------------------------------------
' PopulateIOFields - Read 10 values for the selected car and assign
' to I/O fields IOField1..IOField10.
' ---------------------------------------------------------------------------
Option Explicit
Dim i
Dim sTagName
Dim oTag
Dim oField
Dim carIndex
carIndex = SmartTags("SelectedCarIndex") + 1
If carIndex < 1 Or carIndex > 30 Then carIndex = 1
For i = 1 To 10
sTagName = "Var" & i & "Car" & carIndex
Set oTag = HMIRuntime.Tags(sTagName)
oTag.Read
Set oField = ScreenItems("IOField" & i)
oField.Text = CStr(oTag.Value)
Next
oTag.Read returns the last good value but the tag object also exposes oTag.QualityCode. Check it before writing to the I/O field to avoid showing stale data:If (oTag.QualityCode <> 0) And (oTag.QualityCode <> 192) Then
oField.Text = "###" ' quality-code indicator
Else
oField.Text = CStr(oTag.Value)
End If
Optimized Implementation: 10 Reusable I/O Fields
A more efficient layout uses only 10 I/O fields (IOField1 ... IOField10) and a single StaticText label that shows the active car name. On ComboBox change the 10 fields are re-populated with the new car's data. The 300 tags still exist in tag management, but the screen object count drops from 300 to 11. The trade-off is that the operator no longer sees all 30 cars' values at once; only the active car is visible. This is usually acceptable because the ComboBox is the selection control.
Optimized VBScript
' ---------------------------------------------------------------------------
' ComboBoxCars.OnPropertyChange - Reusable 10-field layout
' 300 tags in tag management, 11 picture objects total.
' ---------------------------------------------------------------------------
Option Explicit
Const FIELD_COUNT = 10
Const CAR_COUNT = 30
Dim i
Dim carIndex
Dim sTagName
Dim oTag, oField, oLabel
Dim aValues(1 To 10)
' 1. Determine which car is selected
carIndex = SmartTags("SelectedCarIndex") + 1
If carIndex < 1 Or carIndex > CAR_COUNT Then carIndex = 1
' 2. Read 10 tags for the selected car into the local array
For i = 1 To FIELD_COUNT
sTagName = "Var" & i & "Car" & carIndex
Set oTag = HMIRuntime.Tags(sTagName)
oTag.Read
aValues(i) = oTag.Value
Next
' 3. Update the visible I/O fields
For i = 1 To FIELD_COUNT
Set oField = ScreenItems("IOField" & i)
oField.Text = CStr(aValues(i))
Next
' 4. Update the header label with the active car name
Set oLabel = ScreenItems("StaticTextCarName")
' Option A: bind StaticText.Text to a TextList tag
' Option B: read from an internal text list tag CarNameList indexed by carIndex
oLabel.Text = SmartTags("ActiveCarName")
Const FIELD_COUNT = 10 syntax is the VBScript-compatible form. The Microsoft VBScript engine shipped with WinCC 7.0 SP3 (5.6 / 5.8 depending on OS) supports Const but does NOT support the As Integer type hint - drop the type clause or the script will fail to compile.Picture Layout Recommendations
For the 10-field reusable layout, the recommended picture geometry is:
| Object | Name | Quantity | Purpose |
|---|---|---|---|
| ComboBox | ComboBoxCars | 1 | Selects active car (0-29) |
| I/O Field | IOField1 ... IOField10 | 10 | Display 10 parameter values for active car |
| Static Text | StaticTextCarName | 1 | Header label showing active car name |
| Static Text (optional) | ParamLabel1 ... ParamLabel10 | 10 | Parameter name labels (constant text) |
For the 300-field layout, group the 30 car groups in a 2D grid (6 columns × 5 rows or 10 columns × 3 rows). Each group contains 10 I/O fields named IOField<j>Car<i> for j=1..10, i=1..30. Bind the VBScript from the "Naïve Implementation" section to the ComboBox event. Both layouts share the same 300 tags in tag management.
Wiring the Event in Graphics Designer
- Open the picture in the Graphics Designer.
- Select the ComboBox object
ComboBoxCars. - Open Properties → Events.
- Right-click the selection-changed event (WinCC 7.0 SP3:
OnPropertyChange; WinCC 7.3+:SelectionChanged) and choose → VBS Action. - Enter the VBScript code from the previous sections.
- Compile (Ctrl+F7) and verify the syntax check passes (status bar at the bottom shows "Compilation successful").
- Save the picture.
- For initial population on picture open, add the same script as a VBS Action on the picture's
OpenPictureevent so the default ComboBox index 0 (Fiat in the source case) is loaded automatically. - Run Graphics Runtime (Start → Runtime) and validate the picture behaviour.
OnPropertyChange; WinCC 7.3 and later also expose a SelectionChanged event on ComboBox-like Smart objects. Always inspect the actual event list in the Graphics Designer for your installed version - the list is generated by the object type, not by WinCC version alone.Performance and Tag Count Considerations
300 tags under WinCC 7.0 SP3 is well below the licensed tag limit. WinCC 7.0 ships with 128 / 256 / 1024 / 8192 PowerTags depending on the license. With a SIMATIC S7 Protocol Suite connection, 300 tags polling an S7-300/400 at the standard 1 s update rate use approximately 3-5% of the protocol driver bandwidth on a single CP. There is no functional concern, but:
- If the PLC is an S7-1200 / S7-1500, prefer OPC UA with a structured tag for the parameter block per car (e.g.
Car1.Param1...Car30.Param10). This keeps the WinCC side clean and moves the array structure to the PLC, which natively supports it. - If the PLC is a legacy S7-300/400, the flat 300-tag layout is the standard pattern.
- For very large datasets (> 5000 tags), consider a WinCC User Archive combined with a WinCC Online Table Control rather than 5000 I/O fields - the User Archive handles CSV/ODBC backends and reduces tag count dramatically.
Script cycle time on the selection event for the 300-field toggle loop is typically < 5 ms on a WinCC Runtime PC. The 10-field reusable loop runs in < 1 ms because only 10 HMIRuntime.Tags(...).Read calls and 10 ScreenItems(...).Text assignments are issued.
Verification Checklist
- Open the picture in Graphics Runtime. The default ComboBox index 0 (Fiat in the source case) is selected and the 10 I/O fields show the values of
Var1Car1...Var10Car1. - Change the ComboBox to "Mercedes" (index 1 in the source example). The 10 I/O fields immediately update to
Var1Car2...Var10Car2. - Select each of the 30 cars in turn. Verify the displayed values change correctly and the header StaticText updates.
- Open the WinCC Channel Diagnosis tool (Start → SIMATIC → WinCC → Channel Diagnosis) and confirm zero communication errors during the selection cycle.
- Open the WinCC Tag Diagnosis (Start → SIMATIC → WinCC → Tag Diagnosis) and verify that all 300 tags are reporting valid values (Quality Code 0xC0 = Good).
- Run the picture on the target Runtime station and confirm the cycle time stays within the configured refresh budget (default 1 s for I/O fields).
- Disconnect the PLC (or stop the S7 connection) and confirm the I/O fields show the configured Quality Code indicator (greyed out or
###), not stale values. - Reconnect the PLC and confirm the I/O fields recover automatically without restarting Graphics Runtime.
Troubleshooting Matrix
| Symptom | Probable Cause | Resolution |
|---|---|---|
| I/O fields do not update on selection | VBScript not compiled, or event not wired | Open Properties → Events on the ComboBox and confirm a VBS action is assigned to the selection-changed event. Recompile (Ctrl+F7). |
| "Object required" error in the GDI runtime log | ScreenItems name typo, or object deleted from picture | Confirm each I/O field name in the Graphics Designer matches the VBScript string. Use HMIRuntime.Screens.Item(...).ScreenItems.Count to enumerate objects. |
| Only the first 10 fields update, others remain at old value | Visibility-toggle approach used but remaining fields not hidden | Confirm the 300-field visibility loop is bound to the same event, or switch to the 10-field reusable layout. |
All I/O fields show ###
|
Quality Code = bad, PLC disconnected | Check WinCC Channel Diagnosis. Verify the S7 connection in WinCC Explorer → Tag Management → SIMATIC S7 Protocol Suite. |
| VBScript returns "Subscript out of range" | ComboBox index out of range (0-29) read as 30 | Add a guard If carIndex < 1 Or carIndex > 30 Then carIndex = 1 or re-bind the Output Value to an INT tag with limits 0-29. |
| Script runs but Text property assignment fails | I/O field configured as "Output" only with no input | Confirm the I/O field is configured for "Input/Output" mode, or use a separate StaticText for output-only display. |
| Performance degrades with picture open | Picture cycles 300 visibility toggles on every tag change | Bind the VBScript to the ComboBox event only, not to a periodic trigger. Move to the 10-field reusable layout. |
| StaticText header does not update | TextList tag not refreshed on selection | Verify the TextList tag is bound to the ComboBox Selection Index property and the TextList index returns the expected car name. |
Migration to WinCC 7.4 / 7.5 / TIA Portal
The same pattern (300 flat tags + VBScript switching) works unchanged on WinCC V7.4 SP1 and V7.5. The recommended modern path is to migrate the picture to WinCC Unified (TIA Portal) or to a Unified Comfort Panel, which exposes proper array tags through the HMI tag interface and supports the JavaScript API. The TIA Portal Help under "WinCC Unified → Scripting → JavaScript runtime API" documents the equivalent JavaScript code for tag arrays.
For S7-1500 users, an S7-1500 user-defined datatype (UDT) bound to a DB of type ARRAY[1..30, 1..10] of INT, exposed to WinCC Unified through OPC UA, removes the 300-tag flat layout and replaces it with a single structured tag. The same ComboBox event then reads selectedCarIndex and updates the visible I/O fields with tagArray[selectedCarIndex][parameterIndex] in a single line.
Reference: WinCC VBScript API Quick Card
| Object / Property | Description | Example |
|---|---|---|
HMIRuntime.Tags("Name") |
Returns a tag object; required for Read/Write | Set oTag = HMIRuntime.Tags("Var1Car1") |
oTag.Read |
Updates the local Value cache from runtime |
oTag.Read |
oTag.Value |
Scalar value (Variant) | Dim v : v = oTag.Value |
oTag.Write |
Pushes the local Value to runtime |
oTag.Value = 42 : oTag.Write |
oTag.QualityCode |
Returns OPC quality code (0xC0 = Good) | If oTag.QualityCode = 192 Then ... |
ScreenItems("Name") |
Returns a picture object by name | Set oField = ScreenItems("IOField1") |
oField.Text |
Get/set displayed text on I/O Field or StaticText | oField.Text = "Hello" |
oField.Visible |
Get/set visibility (Boolean) | oField.Visible = False |
SmartTags("Name") |
Shorthand accessor for an internal tag | Dim i : i = SmartTags("SelectedCarIndex") |
HMIRuntime.Screens |
Enumerate open screens | HMIRuntime.Screens.Item(1).ScreenItems.Count |
For the full API refer to the WinCC Information System installed with WinCC 7.x (Start → SIMATIC → WinCC → Information System) and the VBScript reference inside "Working with WinCC → VBS for Creating Procedures and Actions". The official WinCC V7.5 documentation index is published on the Siemens Industry Online Support portal.
FAQ
How many tags does WinCC 7.0 SP3 require for 30 cars with 10 parameters each?
300 flat process tags named Var1Car1 through Var10Car30, because WinCC 7.x does not expose first-class array tags to the Graphics Designer. The tags can be SIMATIC S7, internal, or OPC UA. The 10 I/O fields on screen can be reused on each ComboBox selection to avoid 300 picture objects.
Which ComboBox event triggers the VBScript in WinCC 7.0 SP3?
On WinCC 7.0 SP3 the event is OnPropertyChange (Properties → Events in the Graphics Designer). On WinCC 7.3 and later a SelectionChanged event is also exposed. Bind a VBS Action to that event to run the tag-read and ScreenItems-update code on every selection change.
Can WinCC V7 replace the 300 I/O fields with a smaller picture object set?
Yes. Use the 10-field reusable layout: keep only IOField1 through IOField10 plus a header StaticText, and re-populate the Text properties of those 10 I/O fields from the 10 tags belonging to the selected car. The 300 tags remain in tag management but the picture object count drops from 300 to 11.
Why does the VBScript return "Object required" on ScreenItems(...)?
Almost always a name mismatch: the picture object name in the Graphics Designer does not match the string passed to ScreenItems. Open the picture, select each I/O field, and confirm the ObjectName property matches the script. With WinCC 7.0 SP3 also confirm the object is not behind a faceplate that scopes the name lookup.
What is the modern alternative to flat 300 tags in WinCC?
WinCC Unified (TIA Portal) supports structured HMI tags and a JavaScript API. With an S7-1500 UDT bound to a DB ARRAY[1..30, 1..10] of INT and exposed via OPC UA, the same functionality is implemented with one structured tag and a small JavaScript handler, removing the flat tag namespace entirely.