Configuring WinCC Online Table Control Time Range for Reports

David Krause10 min read
SiemensTutorial / How-toWinCC
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

Configuring WinCC Online Table Control Time Range for Reports

1. Overview

The WinCC Online Table Control (Classic) ships with a fixed time range property that, by default, evaluates only the table's own time column — not user input from the report page layout. Engineers who need selectable Begin Time and End Time strings (for example, to drive a shift report, an audit export, or a maintenance log) must bind the control's dynamic parameters to internal string tags and select the correct TimeRange property position. This reference documents the working procedure on WinCC V6.2, V7.0, and V7.3, the string-tag data type, the exact hh:mm:ss:ms formatting requirement, and the failure modes that cause the report to keep printing at 1-minute intervals even when the dynamic parameter looks correct.

2. Prerequisites

Item Requirement
WinCC version V6.2 SP2 / V7.0 SP3 / V7.3 (Classic Online Table Control)
License WinCC RT / RC with Process Historian or Tag Logging enabled
Report layout file @CCTableControl.rpl located in the project GraCS folder
Archive source Configured Tag Logging archive feeding the Online Table Control
PLC / data source OPC DA, S7-MPI/TCP, or Simatic OPC UA server returning process values to be logged
Editor rights WinCC Explorer in Configuration mode with project write access
Important: The dynamic parameter behavior described here applies only to the Classic Online Table Control OCX. The newer WinCC Online Table Control (WPF-based, introduced in WinCC V7.4) exposes the same property names but uses a different configuration dialog and supports Date/Time tag data types natively.

3. Anatomy of the Time-Range Parameters

The Classic Online Table Control exposes three configuration levels relevant to time selection:

Configuration Surface Path Effect
Properties → Time Range Time column → TimeRange combo Switches between local time, start time only, start and end time, and rolling
Dynamic Parameter → BeginTime Object properties → Dynamic Binds an external string tag that supplies the report start timestamp
Dynamic Parameter → EndTime Object properties → Dynamic Binds an external string tag that supplies the report end timestamp

The TimeRange combo has four valid enumerations:

  • 0 — Local Time Only: control ignores BeginTime/EndTime; uses its own column time base.
  • 1 — Start Time Only: BeginTime is honored, EndTime is ignored; report runs until stopped.
  • 2 — Start and End Time: both dynamic parameters are evaluated; this is the only mode that respects a user-selected range.
  • 3 — Rolling / Timebase: rolling window independent of dynamic parameters.
Most common cause of failure: the configuration dialog has TimeRange set to 0 or 3. Strings are written to the tags correctly but the control continues to log at its 1-minute default because position 2 has never been activated.

4. Step-by-Step Configuration

4.1 Create Internal String Tags

  1. Open WinCC Explorer → Tag Management → Internal Tags.
  2. Create two new tags:
Tag Name Data Type Length Initial Value
Report_BeginTime Text (8-bit character set) 30 characters 01/01/2000 00:00:00:000
Report_EndTime Text (8-bit character set) 30 characters 01/01/2000 00:00:00:000
Why 8-bit character set? The dynamic parameter property of the Classic OCX passes the tag value through a COM BSTR; Unicode tags (Text (16-bit character set)) introduce a BOM that corrupts the parse. Use 8-bit character set only — UTF-8 is acceptable when the project language is fixed to Latin-1.

4.2 Bind Tags to the Dynamic Parameters

  1. In Graphics Designer, open the report layout @CCTableControl.rpl (or your custom report).
  2. Select the Online Table Control → right-click → Properties → Dynamic.
  3. Locate the BeginTime row and click the small button to open the tag selection dialog.
  4. Bind to Report_BeginTime.
  5. Repeat for EndTime using Report_EndTime.
  6. Close the dialog and save the layout.

4.3 Configure the Time-Range Property

  1. Properties dialog → Time Range category.
  2. Set the TimeRange combo to position 2 (Start and End Time).
  3. Confirm TimeBase is set to Local Time unless the system runs in UTC.
  4. Save and rebuild the runtime.

4.4 Enable Runtime Time Selection Toolbar

  1. Open the control's properties in the Graphics Designer.
  2. Navigate to the Toolbar tab.
  3. Tick the Select Time Range checkbox.
  4. Tick Select Time Base if you want operators to toggle between local and UTC.
  5. Deploy the runtime.

At runtime the table toolbar now displays a clock icon. Clicking it opens the time-range dialog where the operator enters the start and end timestamp in the format configured in the next section.

5. Time Format Specification

The string written to Report_BeginTime and Report_EndTime must match the column header time format. The accepted literal is:

DD/MM/YYYY hh:mm:ss:ms

Where:

  • DD — 2-digit day, zero-padded.
  • MM — 2-digit month, zero-padded.
  • YYYY — 4-digit year.
  • hh — 24-hour, zero-padded.
  • mm — minutes, zero-padded.
  • ss — seconds, zero-padded.
  • ms — 3-digit milliseconds, zero-padded.

Working example for a three-minute window starting 15:40:00.000:

Report_BeginTime = "08/12/2015 15:40:00:000"
Report_EndTime   = "08/12/2015 15:43:00:000"

5.1 Configuring the Column Format

  1. Open Online Table Control → Properties → Columns.
  2. Select the time column.
  3. Set Time Format to hh:mm:ss:ms.
  4. Set Date Format to DD/MM/YYYY.
  5. Verify the column header shows Date Time with milliseconds.
Mismatch warning: if the column is configured for hh:mm:ss (no milliseconds) but the tag carries hh:mm:ss:ms, the OCX parser silently falls back to the default 1-minute logging cycle. Always keep tag format and column format identical.

6. Driving the Tags from HMI I/O Fields

For an operator-driven report, bind two I/O Fields on the report page layout to the same internal tags. Both tags remain freely editable:

I/O Field 1:
   Tag      : Report_BeginTime
   Type     : Input/Output
   Length   : 30
   Format   : String
   Field type: Date/Time

I/O Field 2:
   Tag      : Report_EndTime
   Type     : Input/Output
   Length   : 30
   Format   : String
   Field type: Date/Time

After the operator changes the values, the next print/preview cycle picks up the new range. There is no need to press a separate Apply button.

7. C Action Alternative for Programmatic Control

When the time range must be computed by logic (for example, "last shift" or "yesterday 06:00 to today 06:00"), drive the tags through a C action scheduled every 60 seconds:

// Scheduled C action, trigger 1 s
#include "apdefap.h"
int gscAction(void)
{
    SYSTEMTIME st;
    GetSystemTime(&st);
    char szBegin[32], szEnd[32];

    // End = now
    sprintf(szEnd, "%02d/%02d/%04d %02d:%02d:%02d:%03d",
            st.wDay, st.wMonth, st.wYear,
            st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);

    // Begin = now - 15 minutes
    FILETIME ftBegin;
    SystemTimeToFileTime(&st, &ftBegin);
    ULARGE_INTEGER uli;
    uli.LowPart  = ftBegin.dwLowDateTime;
    uli.HighPart = ftBegin.dwHighDateTime;
    uli.QuadPart -= (ULONGLONG)15 * 60 * 10000000ULL;   // 15 min in 100 ns
    ftBegin.dwLowDateTime  = uli.LowPart;
    ftBegin.dwHighDateTime = uli.HighPart;
    FileTimeToSystemTime(&ftBegin, &st);
    sprintf(szBegin, "%02d/%02d/%04d %02d:%02d:%02d:%03d",
            st.wDay, st.wMonth, st.wYear,
            st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);

    SetTagChar("Report_BeginTime", szBegin);
    SetTagChar("Report_EndTime",   szEnd);
    return 0;
}

8. Common Issues and Root-Cause Matrix

Symptom Likely Root Cause Corrective Action
Report prints 1-minute window regardless of tag values TimeRange combo is set to position 0 or 3 Change TimeRange to position 2 (Start and End Time)
BeginTime ignored, EndTime honored TimeRange set to position 1 (Start only) Change to position 2
Tag value visible in tag management but control does not update Tag uses Unicode (16-bit) character set; BSTR corrupts parse Re-create tag as 8-bit character set
Control shows 1-minute archive log even after typing hh:mm:ss:ms string Column time format does not include milliseconds Set column Time Format to hh:mm:ss:ms
Toolbar shows time-range icon but operator input has no effect Properties → Dynamic only contains the value, not a properly tagged variable Re-bind via Properties → Dynamic → tag picker (not direct text entry)
Report prints correct window on first call, reverts on second BeginTime/EndTime tags are external process tags overwritten by PLC Use internal tags that nothing else writes to
Date rejected as invalid Format mismatch (MM/DD vs DD/MM depending on regional settings) Align tag format to Windows regional short date OR force DD/MM/YYYY explicitly in the column
Runtime shows only start time, no end time field Toolbar property "Select Time Range" not enabled Tick "Select Time Range" in Properties → Toolbar
C script SetProperty fails with type mismatch Passing VT_DATE instead of VT_BSTR Cast to BSTR string before SetProperty call
Report layout regeneration resets the tag bindings User re-applied default @CCTableControl.rpl Use a custom @UserTableControl.rpl copy and apply bindings after each regeneration

9. Verification Procedure

  1. Activate the runtime project.
  2. Open the report page layout containing the Online Table Control.
  3. Click the toolbar's Select Time Range icon.
  4. Enter a 3-minute window that crosses a known data change (for example, 15:40:00.000 to 15:43:00.000).
  5. Confirm the table refreshes to show only rows within that range.
  6. Print / preview the report and inspect the layout's header to verify BeginTime and EndTime are rendered.
  7. Open WinCC Tag Management → confirm both internal tags hold the exact strings entered.
  8. Re-enter a 1-second window; confirm only rows whose time column falls within that second appear.
  9. Re-enter a window that contains zero data; confirm the report prints an empty table instead of falling back to 1-minute default.

10. Version-Specific Notes

WinCC Version Behavior
V6.0 / V6.2 Toolbar "Select Time Range" available; OCX uses same BSTR path. String tags must be 8-bit.
V7.0 SP3 Dynamic parameter binding is exposed under Properties → Dynamic; tag picker identical to V7.3.
V7.3 Same procedure. @CCTableControl.rpl still shipped as default; copy and rename to preserve custom bindings.
V7.4 and later Classic OCX retained for backward compatibility; new WPF Online Table Control uses native Date/Time tags — recommended for new projects.
TIA Portal WinCC Comfort/Advanced Different control family (Process Tag / Historical View) — not covered by this article.
Backup recommendation: before modifying the report layout, copy @CCTableControl.rpl to a project-local name such as @MyReport_TableControl.rpl. The default file is regenerated by WinCC on project upgrade and your dynamic-parameter bindings will be lost.

11. Field-Proven Caveats

  • Time zone awareness: if the WinCC server is configured for UTC and the operator enters local time, the report will be off by the UTC offset. Confirm the column Time Base is Local Time in distributed systems.
  • Daylight saving: the OCX does not automatically compensate for DST transitions. Reports spanning the spring-forward hour may show 60 duplicate rows or skip rows by one hour.
  • Archive gaps: selecting a window that crosses a gap in the archive (power loss, network outage) prints the rows that exist; missing data is not interpolated. Document this in the SOP for the operator.
  • Multi-column tables: every column shares the same time range because the time range is a control-level property. Each column does not need its own BeginTime/EndTime tag — the two tags are global to the control.
  • Print spool: when generating a report on a slow spooler, the tags may be overwritten by another button press before the print job is committed. Lock the tags with a bPrintInProgress boolean and reject concurrent updates.
  • Performance: the OCX loads the entire requested window into memory before sending it to the printer. A 24-hour window with a 100 ms logging cycle loads ~864 000 rows. For large windows, prefer the WPF control introduced in V7.4.

Why does my WinCC Online Table Control report keep printing a 1-minute window even after I assigned BeginTime and EndTime tags?

The most common cause is that the control's TimeRange property is not set to position 2 (Start and End Time). Open the control's properties and switch the Time Range combo to position 2; values written to the tags will then be honored at the next print or preview cycle.

What data type should the BeginTime and EndTime tags use in WinCC?

Use internal tags of type Text (8-bit character set) with at least 30 characters of length. Unicode (16-bit) tags introduce a BOM into the COM BSTR that the Classic OCX cannot parse and the dynamic parameter silently fails.

What time-string format must I write to Report_BeginTime and Report_EndTime?

The format is DD/MM/YYYY hh:mm:ss:ms, zero-padded, e.g. 08/12/2015 15:40:00:000. The column header time format in the Online Table Control must be configured to hh:mm:ss:ms; otherwise the OCX falls back to its default 1-minute logging cycle.

How do I add a date/time picker on the report page for the operator?

Place two I/O Fields on the report page layout bound to the same internal string tags Report_BeginTime and Report_EndTime. Set field type to Date/Time and length to 30 characters. Operator changes are picked up by the next print/preview without an Apply button.

Can I drive BeginTime and EndTime from a C action or script?

Yes. Use SetTagChar on the two internal tags from a scheduled C action, or use the OCX's automation interface: SetProperty("BeginTime", VT_BSTR, "08/12/2015 15:40:00:000"). Always pass VT_BSTR; passing VT_DATE raises a type-mismatch error.

Where is the default report layout file stored in WinCC 7.x?

The default Online Table Control report layout is @CCTableControl.rpl in the project's GraCS folder. Copy it to a custom name (e.g. @MyReport_TableControl.rpl) before editing, otherwise a WinCC upgrade will overwrite your tag bindings.

Back to blog