You are on page 1of 80

Exporting Archived

Data from WinCC


Using the
OLE DB Provider
Siemens
SIMATIC WinCC V7.4 SP1 + WinCC/Connectivity Pack Industry
Online
https://support.industry.siemens.com/cs/ww/en/view/38132261 Support
Warranty and Liability

Warranty and Liability

Note The Application Examples are not binding and do not claim to be complete regarding the
circuits shown, equipping and any eventuality. The Application Examples do not represent
customer-specific solutions. They are only intended to provide support for typical
applications. You are responsible for ensuring that the described products are used
correctly. These Application Examples do not relieve you of the responsibility to use safe
practices in application, installation, operation and maintenance. When using these
Application Examples, you recognize that we cannot be made liable for any
damage/claims beyond the liability clause described. We reserve the right to make
changes to these Application Examples at any time without prior notice.
If there are any deviations between the recommendations provided in these Application
Examples and other Siemens publications – e.g. Catalogs – the contents of the other
documents have priority.

We do not accept any liability for the information contained in this document.
Any claims against us – based on whatever legal reason – resulting from the use of
the examples, information, programs, engineering and performance data etc.,
described in this Application Example shall be excluded. Such an exclusion shall
not apply in the case of mandatory liability, e.g. under the German Product Liability
Act (“Produkthaftungsgesetz”), in case of intent, gross negligence, or injury of life,
body or health, guarantee for the quality of a product, fraudulent concealment of a
deficiency or breach of a condition which goes to the root of the contract
(“wesentliche Vertragspflichten”). The damages for a breach of a substantial
contractual obligation are, however, limited to the foreseeable damage, typical for
 Siemens AG 2018 All rights reserved

the type of contract, except in the event of intent or gross negligence or injury to
life, body or health. The above provisions do not imply a change of the burden of
proof to your detriment.
Any form of duplication or distribution of these Application Examples or excerpts
hereof is prohibited without the expressed consent of the Siemens AG.

Security Siemens provides products and solutions with industrial security functions that support the
informa- secure operation of plants, systems, machines and networks.
tion In order to protect plants, systems, machines and networks against cyber threats, it is
necessary to implement – and continuously maintain – a holistic, state-of-the-art industrial
security concept. Siemens’ products and solutions only form one element of such a
concept.
Customer is responsible to prevent unauthorized access to its plants, systems, machines
and networks. Systems, machines and components should only be connected to the
enterprise network or the internet if and to the extent necessary and with appropriate
security measures (e.g. use of firewalls and network segmentation) in place.
Additionally, Siemens’ guidance on appropriate security measures should be taken into
account. For more information about industrial security, please visit
http://www.siemens.com/industrialsecurity.

Siemens’ products and solutions undergo continuous development to make them more
secure. Siemens strongly recommends to apply product updates as soon as available and
to always use the latest product versions. Use of product versions that are no longer
supported, and failure to apply latest updates may increase customer’s exposure to cyber
threats.
To stay informed about product updates, subscribe to the Siemens Industrial Security
RSS Feed under http://www.siemens.com/industrialsecurity.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 2
Table of Contents

Table of Contents
Warranty and Liability ................................................................................................. 2
1 Introduction ........................................................................................................ 4
1.1 Overview............................................................................................... 4
1.2 Mode of operation ................................................................................ 5
1.3 Description of the WinCC application ................................................... 6
1.3.1 Overview and description of the reverse osmosis plant ....................... 6
1.3.2 Functionality of the reverse osmosis plant ........................................... 9
1.4 Components used .............................................................................. 13
2 Exporting archive data with WinCC ............................................................... 14
2.1 Mode of operation .............................................................................. 14
2.2 Configuration and Settings ................................................................. 15
2.2.1 Configurations in the sample project .................................................. 15
2.2.2 Configuring the scripts for exporting archive data .............................. 16
2.2.3 Script for exporting archived tags ....................................................... 16
2.2.4 Script for exporting archived alarms ................................................... 28
2.3 Operation ............................................................................................ 40
2.3.1 Export of archived tags using VBS script ........................................... 40
2.3.2 Export of archived alarms using VBS script ....................................... 40
3 Exporting archive data with Excel ................................................................. 41
3.1 Mode of operation - overview ............................................................. 41
 Siemens AG 2018 All rights reserved

3.2 Mode of operation - details ................................................................. 42


3.2.1 The SQL command ............................................................................ 42
3.2.2 Expansion capability of the message structure .................................. 50
3.3 Configuration and Settings ................................................................. 53
3.3.1 First call of the application .................................................................. 53
3.3.2 Setup of the application window ......................................................... 53
3.3.3 Toolbar design .................................................................................... 57
3.3.4 Table view .......................................................................................... 57
3.4 Operation ............................................................................................ 58
3.4.1 Calling up the application ................................................................... 58
3.4.2 Editing Default settings....................................................................... 59
3.4.3 Editing filter settings ........................................................................... 60
3.4.4 Adapting the message structure ........................................................ 63
3.4.5 Reading Messages ............................................................................. 65
3.5 Error handling ..................................................................................... 66
4 Exporting archive data with SQL Server ....................................................... 67
4.1 Configuration ...................................................................................... 67
5 Valuable Information ....................................................................................... 76
5.1 Basics ................................................................................................. 76
5.1.1 SIMATIC WinCC/Connectivity Pack ................................................... 76
5.1.2 WinCC OLE DB Provider ................................................................... 76
5.1.3 Requirement for connecting to the WinCC database ......................... 76
5.2 Alternative solutions ........................................................................... 77
6 Annex ................................................................................................................ 78
6.1 Service and support ........................................................................... 78
6.2 Links and literature ............................................................................. 80
6.3 Change documentation ...................................................................... 80

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 3
1 Introduction

1 Introduction
1.1 Overview
Motivation
Numerous process variables are required for the visualization of modern
automation systems. Alarms notify the user of events that occur during the
process. Past process variables and alarms are stored in archives and are always
available to the user.
WinCC stores the data in the archives in a compressed and binary-coded format.
WinCC allows the user to display the archived process variables and alarms.
However, the data format cannot be used for analysis and further processing.

Task
The requirement is to export the data to other formats, e.g. “*.csv” or “*.xls”. Then
they can be conveniently used in office applications, ERP systems and MES.

Figure 1-1

Visualization
 Siemens AG 2018 All rights reserved

O f f i ce appl i cat i on,


ERP, MES syst ems

*.c sv
*.xls

Ext ernal dat a f ormat

Archi ve

Assumed knowledge
Basic knowledge of WinCC V7 is assumed.

Note Basics can be acquired in the “SIMATIC WinCC, system course” in the SITRAIN
series.
 SIMATIC WinCC, Systemkurs (de)
 SIMATIC WinCC, System Course (en)

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 4
1 Introduction

1.2 Mode of operation


The SIMATIC WinCC/Connectivity Pack option is used to export the WinCC
archive data. It provides the WinCC OLE DB Provider.
The WinCC OLE DB Provider enables transparent access to WinCC archive data.

Figure 1-2

WinCC
Application

Of f ice ap p lication ,
Arch ive
ERP, MES systems
Project d at a

WinCC /ConnectivityPack * .csv


OLE DB Provid er * .xls

Ext ern al d at a f ormat


 Siemens AG 2018 All rights reserved

Arch ive Arch ive


Arch ive Arch ive
Alarm Logging R u n t ime data
Tag Log g in g Fast Tag Log g in g

Arch ive
SlowTag Log g in g

This document describes solutions for the export of the


archived data using Visual Basic (VB) scripts and the SQL Manager. The solutions
use the WinCC OLE DB Provider.

The following data is exported:


 Archived process values
 Archived alarms

Three variants for creating new data formats are examined:


 Exporting the archive data using a VB script in the WinCC project
 Exporting the archive data using Visual Basic for Applications (VBA) with Excel
 Exporting the archive data using MS SQL Server Management Studio

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 5
1 Introduction

1.3 Description of the WinCC application


This application example simulates a reverse osmosis plant for process water
treatment like it is used, for example, in the pharmaceutical industry or in
breweries.

Note The reverse osmosis plant is designed as a WinCC project and is contained in
the application example as a download.

The plant has the following modes:


 Startup
 Production
 Shutdown
 OFF

VB scripts simulate all operating conditions. WinCC archives store the process
variables and alarms.

1.3.1 Overview and description of the reverse osmosis plant

Figure 1-3
 Siemens AG 2018 All rights reserved

The application example has several buttons to control the plant and to export
archive data.
Visualization of:
 Valves
 Several pressure indicators
 An outlet and motor

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 6
1 Introduction

Depending on the status, the associated valve and motor HMI tags are set to “ON”
(1) or “OFF” (0). When active, the color of the objects changes. Fehler!
Unbekanntes Schalterargument. gives a short description of the buttons.

Table 1-1
Buttons Description

This button activates the previous screen.

This button activates the start screen of the application example.

This button changes the language from English to German and vice
versa.

This button exits WinCC Runtime of the application example.

STARTUP Sets the plant to “Startup” mode.


SHUTDOWN Sets the plant to “Shutdown” mode.
STOP Sets the plant to “Off” mode.
Alarm Control Opens the “Alarm Control” ActiveX control. This ActiveX control
shows the past plant status alarms.
Trend Control Opens the “Trend Control” ActiveX control. This ActiveX control
 Siemens AG 2018 All rights reserved

shows the trend of the simulated, analog measuring points of the


plant.
Export Tags Starts the VBS script for the export of measuring values to a “*.csv”
file.
Export Alarms
Starts the VBS script for exporting the alarms to a *.csv file.

Table 1-2
Valves (V) / pump (P) Description
V700 Raw water valve
V701 Process water valve
V702 Tank outlet valve
V703 Concentrate valve
V704 CO2 valve
V705 Chemicals valve
V706 Outlet valve
P800 Motor/pump for raw water

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 7
1 Introduction

The current states of the simulated process variables are displayed via analog
measuring points (I/O fields). The process variables (Fehler! Unbekanntes
Schalterargument.) describe:
 Flows in the tubing
 Conductivity of the liquids
 Pressure states at different measuring points within the tank

Table 1-3
Analog Unit Description
measuring points
3
FI100 m /h Raw water inlet
3
FI101 m /h Tank outlet
3
FI102 m /h Outlet outside tank
FI300 l/h CO2 inlet
FI500 l/h Chemicals inlet
QI901 µs/cm Concentrate conductivity
QI900 µs/cm Process water conductivity
PI200 bar Tank pressure sensor1
PI201 bar Tank pressure sensor2
PI202 bar Tank pressure sensor3
 Siemens AG 2018 All rights reserved

PI203 bar Tank pressure sensor4

Sequence of the core functionality

Table 1-4
No. Mode Note
1. OFF After starting the application example in WinCC Runtime, the
plant is in “Off” mode.
The valves and motors are in their initial position (state: “0”).
Analog measuring points have either their start value or the
value “0”.
The “STOP” button simulates an emergency intervention in the
running plant. The plant is shut down and goes to “Off”.
2. Startup After the “startup” process, the plant automatically goes to the
“production” process.
The valves and the motor close/stop gradually. Simulated
values are written to all analog measuring points.
3. Production All valves and the motor are activated. Simulated, slightly
varying values continue to be written to the analog measuring
points.
4. Shutdown After “shutting down” the plant, it returns to “Off”.
The valves and the motor close/stop gradually. Simulated
values are written to measuring points that are still
technologically active.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 8
1 Introduction

1.3.2 Functionality of the reverse osmosis plant

After starting Runtime, the “Measurement.bac” and “SimReverseOsmosis.bac”


actions, in which several procedures and functions are carried out, are called on an
event-triggered basis. They control the process and simulation of the analog
measured variables. The scripts have been created with VBS. The complete plant
process is simulated in twelve steps. Five steps for the startup process, seven for
the shutdown process, where step 0
reflects the “Off” status and step 5 reflects the “Production” status.

Actions
Table 1-5
Action Call – trigger Description
Measurement.bac cyclically - Controls the calculation of values of
Timer = 1 s the individual analog measuring
points by calling the “MeasMode” and
“Measurement” scripts. The required
simulation parameters are transferred
within the action.
SimReverseOsmosis.bac cyclically - Simulates the process of the reverse
Timer = 1 s osmosis plant by calling the
“StepControl” and “ActuatorControl”
scripts.
 Siemens AG 2018 All rights reserved

Procedures
Table 1-6
Procedure Call Description
StepControl.bmo Action Simulates the individual steps of
“SimReverseOsmosis” the plant through different
sequences (StartupSequence,
ShutdownSequence,
StopSequence).
MeasMode.bmo “Measurement” action Simulates the status of the
individual analog measuring points.
Measurement.bmo “Measurement” action Simulates the values of the
individual analog measuring points.
ActuatorControl.bmo “SimReverseOsmosis” Simulates the states of valves and
action motor, depending on the plant
status.
WriteArchiveToCSV.bmo Trigger button Creates a *.csv file, accesses the
“WriteArchiveToCSV” archive using the WinCC OLE DB
Provider and writes the archive
entries for the
“QI901_ConductivityPermeatIn” tag
to this file. Only the tag name, time
of measurement, tag ID and value
are saved.
WriteMessagesToCSV. Trigger button Creates a *.csv file, accesses the
bmo “WriteMessagesToCSV” archive using the WinCC OLE DB
Provider and writes the archive
entries with an alarm number <4 to
this file. Only the time of
measurement, alarm number, alarm
type and alarm class are saved.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 9
1 Introduction

“Startup” button
 The start time is determined and entered in the “Start” output field.
 The “StartupSequence” is started.
 The “Status” display changes to “Startup” mode.
 The valves and the motor open/start gradually. Simulated values are written to
all analog measuring points. The Startup process consists of the following five
steps:

Figure 1-4

Status:
Startup
1

V703: open V704: open


Current step = 1 Current step = 4
V706: open V705: open

V700: open Current step = 2 V702: open Current step = 5


 Siemens AG 2018 All rights reserved

Status:
P800: active Current step = 3 Production

Simulated values are written to all analog measuring points. The values selected for this
example can be customized in the script at any time.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 10
1 Introduction

Tags
Table 1-7
Tags Set value Min Max Step size
FI100_FlowRawwater 0 60 150 9
FI101_FlowConcentrate 0 10 7 120
= FI100 –
FI101 +
FI102_SupplyWater - - -
(FI300/1000) +
(FI500/1000)
FI300_FlowCO2 0 1 19 2
FI500_FlowChemicals 0 1 11 1.5
QI900_ConductivityPermeatIn 1511 1310 1556 33
QI901_ConductivityConcentrate 1900 1300 2000 56
PI200_Tank 0 1.1 5.5 0.35
PI201_Tank 0 1.1 5.4 0.32
PI202_Tank 0 1.1 5.3 0.31
PI203_Tank 0 1.1 5.2 0.30

 Trend recording starts on an event-triggered basis when the plant is started up.
 The startup process takes approx. 25 seconds until the plant goes to
“Production” mode.
 Siemens AG 2018 All rights reserved

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 11
1 Introduction

SHUTDOWN button
The “Status” display changes to “Shutdown” mode.
 The “ShutdownSequence” is started.
 The valves and the motor close/stop gradually. Simulated values continue to
be written to analog measuring points that are still technologically active. The
Shutdown process consists of the following seven steps (steps 6-12):

Figure 1-5

Status:
Shutdown
1

V701: open Current step


V702: closed Current step = 6
V703: open = 10

V704: closed V701: closed Current step


Current step = 7 V703: closed = 11
V705: closed
 Siemens AG 2018 All rights reserved

Current step
P800: inactive Current step = 8 V706: closed
= 12

Status:
Current step OFF
V700: closed
=9

 The shutdown process takes approx. 25 seconds until the plant goes to “Off”
mode.
 Trend recording stops on an event-triggered basis when the plant goes to “Off”.
 The stop time is determined and entered in the “Off” output field.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 12
1 Introduction

"Stop" button
 The “Status” display changes to “Off” mode.
 The “StopSequence” is started.
 The valves and motors close/stop immediately, analog measuring points are
reset to their start value.
 Trend recording stops on an event-triggered basis when the plant stops.
 The stop time is determined and entered in the “Off” output field.
 The plant goes to “OFF” mode.

“Production” button
All valves and the motor are active (“1” state). Simulated, slightly varying values continue to be
written to the analog measuring points (see Fehler! Unbekanntes Schalterargument.).

“Off” button
The valves and motors are in their initial position (state: “0”). Analog measuring points have
either their start value (see Fehler! Unbekanntes Schalterargument.) or the value “0”.

1.4 Components used


This application example was created with the following hardware and software
components:
 Siemens AG 2018 All rights reserved

Table 1-8
Component Numbe Article number Note
r
Engineering Station 1 Development computer
with Windows 7x64 SP1
SIMATIC WinCC V7.4 SP1 1 6AV63.1-....7-4...
SIMATIC
WinCC/Connectivity Pack 1 6AV6371-1DR07-4...
V7.4 SP1
MS SQL Server 2008 R2 1
MS Excel 2007, 2010,
1
2013

This application example consists of the following components:

Table 1-9
Component File name Note
WinCC project This compressed file
38132261_Application_Reverse_Osmosis_PR
contains the WinCC
OJ.zip
project.
Excel file 38132261_Application_Reverse_Osmosis_XL This compressed file
S.zip contains the WinCC
project.
Documentation This document is the
38132261_ documentation for
Application_Reverse_Osmosis_DOC_de.pdf the application
example.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 13
2 Exporting archive data with WinCC

2 Exporting archive data with WinCC


2.1 Mode of operation
 Data access to the Runtime archive is achieved with VBS scripts in WinCC.
 The archive data are exported to CSV files.

Figure 2-1
 Siemens AG 2018 All rights reserved

WinCC/Connectivity Pack
OLE DB Provider
*.csv
Exported data

• Tag
“QI900_ConductivityPermeatIn”
• All messages in the last
24 hrs with MsgNo. < 4

Archive

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 14
2 Exporting archive data with WinCC

2.2 Configuration and Settings


This chapter describes how to configure your own project in order to export archive
data to a CSV file using the WinCC OLE DB Provider.

Note The scripts shown in chapter 2 are examples and have already been created in
the WinCC project. The WinCC is therefore ready for operation immediately after
customizing the computer name.

2.2.1 Configurations in the sample project

Customizing the computer name


1. Unzip the file named “38132261_Application_Reverse_Osmosis_PROJ.zip”
into any WinCC project directory on your computer.
2. Open the WinCC project named
“WinCC73_SE_UPD8_Connectivity_Pack.MCP” and in the project, customize
the computer name in the computer properties: Use the “My computer ->
Properties” context menu to apply the Windows computer name of your PC.
3. Restart WinCC.

Note The resolution is preset to 1520 x 900 pixels.


 Siemens AG 2018 All rights reserved

The project is bilingual (alternatively German/English) has the option to switch


between languages.

Script debugger
If you would like to debug the VB scripts, you can use a script debugger. For
licensing reasons, is not supplied with SIMATIC WinCC for SIMATIC WinCC V6.2
or higher.
To enable the display and debugging of script errors, make the following settings
under “Computer properties” in the “Runtime” tab:
Figure 2-2

Note The MS script debugger is part of your WinCC installation pack. More
information on WinCC can be found in the online help in chapter “Testing with
the debugger”.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 15
2 Exporting archive data with WinCC

Starting the debugger


If the “Start debugger” function is checked, the debugger is started when the first
script starts in Runtime. The function is used for quick debugging during the
configuration phase.
The “Start debugger” function can be configured separately for VBS scripts in
Graphics Designer screens and for VBS scripts in Global Script. To do this, check
the appropriate “Start debugger” check box.

Note Further information is available in the actual Documentation „WinCC V7.4


Scripting: VBS, ANSI-C, VBA“, in chapter “How to activate the debugger”
https://support.industry.siemens.com/cs/ww/en/view/109736230/70687471243

Displaying the error dialog


If the “Display error dialog” function is checked, an error dialog with information
about the occurred error is displayed when an error has occurred in a VBS script. A
debugger can be started using a button in the error dialog. This requires an
installed debugger for Visual Basic.
The “Display error dialog” function can be configured separately for VBS scripts in
Graphics Designer screens and for VBS scripts in Global Script. To do this, check
the appropriate check box.

2.2.2 Configuring the scripts for exporting archive data


 Siemens AG 2018 All rights reserved

After the end of a production cycle of the reverse osmosis plant, the measured
values archived between the start and stop time are entered in a *.csv file.
The stop, startup and shutdown times of the osmosis plant are entered into the
message archive as operational messages. They have the message numbers 1, 2,
and 3. In this application example, the startup, shutdown and stop alarms of the
last 24hrs are to be written to a *.csv file.
The solution of this task is shown using a script. It was created with the Global
Script Editor from WinCC. It can be called up on an event-triggered basis (by
pressing a button or with a tag trigger).

2.2.3 Script for exporting archived tags

To make this clearer, this example looks only at measuring point QI900
(conductivity of the generated process water). Its archived values are written to a
CSV file by pressing a button.
Alternatively, it is possible to simultaneously retrieve multiple measured values in
VB code.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 16
2 Exporting archive data with WinCC

Creating the VBS module

Table 2-1
No. Action
1. Start the Global Script VBS Editor.

2. Select the “Project Modules” tab and create a new folder named
“WriteArchiveToCSV”.
 Siemens AG 2018 All rights reserved

3. In this folder, create a new project module.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 17
2 Exporting archive data with WinCC

No. Action
4. Change the sub-procedure to a function. Add the “ArchiveName” and
“MeasuringPoint” parameters to this function. Save the project module as
“WriteArchiveValuesToCSV”.

Archive name (ArchiveName parameter) and measuring point name


(MeasuringPoint parameter) are transferred later when calling the function.

VBS code: Generating the *.csv file


In the first step of the VBS code, the “*.csv” file is saved in the “C:\Temp\” folder.
The file name is to be composed of the plant name, “Osmosis”, the start time of the
osmosis plant and the measuring point name of the measuring point to be
archived.
 Siemens AG 2018 All rights reserved

(E.g.: C:\Temp\Osmosis_15.02.2015 10:30:00 QI900.csv)

Table 2-2
No. Action
1. Start the code by declaring the following tags:
'Declaration of local Tags
Dim fso 'FileSystemObject
Dim f 'File
Dim ts 'TextStream
Dim path 'Path
Dim StartArchive 'Starttime of Archiving
Dim StopArchive 'Stoptime of Archiving
Dim TimeStamp 'Timestamp for bulding filename
2. Then use the following code to read the start and stop times of the reverse osmosis
plant. The internal WinCC tags for this are “DateTimeLastStart” and
“DateTimeLastStop”. When the plant starts and stops, the respective times (format:
dd.mm.yyyy hh:mm:ss) are saved to these tags.
'Read Start- and Stoptime of Osmosis
Set StartArchive = HMIRuntime.Tags("DateTimeLastStart")
Set StopArchive = HMIRuntime.Tags("DateTimeLast")
If the start and stop times are missing, an alarm is to be displayed and processing
the function is to be terminated.
If StartArchive.Read = "" Or StopArchive.Read = "" Then
MsgBox "Start- or Stoptime of Archiving is missing"
Exit Function
End If

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 18
2 Exporting archive data with WinCC

No. Action
3. Define the path and file name. The “path” tag contains the complete file name,
including the path in the following form:
C:\Temp\Osmosis_ + Start time + _Measuring point name
In the application example, the start time is used to generate the file name and must
first be converted to a suitable format.
'Generate String for the csv-filename and replace ":" with
"_"
TimeStamp = FormatDateTime(StartArchive.Read, vbGeneralDate)
TimeStamp = Replace(TimeStamp,":", "_")
'Path and name for the *.csv file
path = "C:\Temp\" & "Osmosis_" & TimeStamp & "_" &
MeasuringPoint & ".csv"
4. Subsequently, you use the following code to generate the file system object (fso)
and the file object (f) using the previously formed path and file name (path). Before
doing so, the system checks whether the file already exists and, if this is the case,
processing the function is terminated after displaying a message.
'Create FileSystemObject and *.csv file if it not exist:
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FileExists(path) Then
fso.CreateTextFile(path)
Else
 Siemens AG 2018 All rights reserved

MsgBox "File already exist:" & vbCrLf & path


Exit Function
End If
Finally, the *.csv file is opened with the TextStream object (ts) for writing.
'Create File-Object and open this File
Set f = fso.GetFile(path)
'iomode = 2, Writing
'format = -2, TristateUseDefault
Set ts = f.OpenAsTextStream(2,-2)
'*.csv file is now ready for Writing
The script is done. The file is not generated before the script is run.

Connection to the database


The second step of the function establishes the connection to the database using
the WinCC OLE DB Provider. The measured value archive data is entered in a
RecordSet (a copy of several data records). The following fields are transferred per
data record:

Table 2-3
FieldNo. Field name Type Meaning
0 ValueID (4-byte) integer ID of the process value
1 TimeStamp DateTime Time stamp of the process value
2 RealValue (8-byte) real Process value
3 Quality (4-byte) integer QualityCode of the process value

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 19
2 Exporting archive data with WinCC

Establishing the connection


To establish the connection to the database, a connection object must be
generated and the ConnectionString must be transferred. The ConnectionString
requires:
 The provider name
 The provider instance number
 The user data source name (DSN, GUID of the WinCC project)
 As a WinCC data source, including the computer name

General format of the “ConnectionString”:


ConnectionString = “Provider=<ProviderName>.<InstanceNo.>;Catalog=<DSN of
Database>R;Data Source=<ComputerName>\WinCC”

Note Access is also possible without specifying the computer name (.\WinCC). This
decreases the access speed, however.
For transparent access, enter the WinCC project name for “Catalog”, e.g.
“Catalog = WinCC_Project_Name”.

Querying the data


To query the data, a command object must be generated to which a
“CommandText” is then transferred for processing. The “CommandText” must
 Siemens AG 2018 All rights reserved

contain:
 The action (R = read access)
 The ValueID or the symbolic name of the archive tag
 The start and stop time (Starttime and Endtime)

Format of the “CommandText”:


CommandText = “Tag:<Action>,< ValueID or ArchiveName\Tagname>',
'<StartTime>,'<StopTime>'”

Note To query multiple archived values at the same time, enter the ValueIDs or tag
names in parentheses, separated by semicolons, e.g.
“TAG:R,('ValueName_1';'ValueName_2';'ValueName_x'), <TimeBegin>,
<TimeEnd>”.

The times (start time or stop time) can be transferred as absolute or relative values.

Table 2-4
Start time Stop time Queried time range

2016-02-15 14:10:00:000 2016-02-15 14:30:00:000 15.02.2016 14:10 to 14:30

2016-02-15 14:10:00:000 0000-00-00 01:00:00:000 15.02.2016 14:10 to 15:10

0000-00-00 01:00:00:000 2016-02-15 14:30:00:000 15.02.2016 13:30 to 14:30

0000-00-00 00:00:00:000 0000-00-00 00:01:00:000 Start of archive to end of archive


+1 min.

0000-00-00 00:01:00:000 0000-00-00 00:00:00:000 End of archive 1 min. to end of


archive

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 20
2 Exporting archive data with WinCC

Note The time stamp of the process values is stored as UTC (Coordinated Universal
Time). Therefore, the regional time zone and, if necessary, daylight saving
time/standard time must be considered when entering the start and end times as
absolute values.
For information on converting the local computer’s time to UTC, please use the
following link:
https://support.industry.siemens.com/cs/ww/en/view/24201113

Note The query using “ValueID” has a higher performance than the query using
“ArchiveName\Tagname”. However, the ValueID is not identical to the tag order
in the Tag Logging editor. The ValueID of a tag can be determined using SQL
Server Management Studio. Go to the SQL Server Management Studio and
open the table “dbo.Archive” in the runtime database of the project. The ValueID
is listed in the first column of the table.

Establishing the connection and querying the data

Table 2-5
No. Action
 Siemens AG 2018 All rights reserved

1. Declare the other tags:


Dim Pro 'Provider
Dim DSN 'Data Source Name
Dim DS 'Data Source
Dim ConnString 'Connection String
Dim MachineNameRT 'Name of the PC from WinCC-RT
Dim DSNRT 'Data Source Name from WinCC-RT
Dim Conn 'Connection to ADODB
Dim RecSet 'RecordSet
Dim Command 'Query
Dim CommandText 'Command-Text
Dim CommandTextStart 'Starttime for SQL-String
Dim Duration 'Duration of Production-Cycle
Dim DurationSec 'Duration of Production-Cycle
Dim DurationMin 'Duration of Production-Cycle
Dim DurationHour 'Duration of Production-Cycle
Dim DurationDay 'Duration of Production-Cycle
Dim Language 'Language tag

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 21
2 Exporting archive data with WinCC

No. Action
2. Use the following code to read the computer name and the GUID of the project
from the environment tags “@LocalMachineName” and “@DataSourceNameRT”
into the previously declared local tags.
'Read the name of the PC-Station and the DSN-Name from
'WinCC-RT
Set MachineNameRT = HMIRuntime.Tags("@LocalMachineName")
Set DSNRT = HMIRuntime.Tags("@DatasourceNameRT")
Create the “ConnectionString” with the aid of these tags.
'Preparing the Connection-String
'First instance of WinCCOLEDB
Pro="Provider=WinCCOLEDBProvider.1;"
'Name of Runtime-Database
DSN="Catalog=" & DSNRT.Read & ";"
'Data Source
DS= "Data Source=" & MachineNameRT.Read & "\WinCC"
'Build the complete String:
ConnString = Pro + DSN + DS
3. Then use the “ConnectionString” to establish the connection to the database:
'Make Connection
Set Conn = CreateObject("ADODB.Connection")
 Siemens AG 2018 All rights reserved

Conn.ConnectionString = ConnString
Conn.CursorLocation = 3
Conn.open
Note:
To define the RecordSet location for the query of archive data, assign a value to
the “CursorLocation” property. The value “3” is assigned in the example.
Therefore, the RecordSet is created on the client.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 22
2 Exporting archive data with WinCC

No. Action
4. The “CommandText” is required to query the data in the WinCC database.
In this application example, the relative time is used for the query. The start time
is the difference between start time and end time. Therefore, the query comprises
the period “end of archive minus time difference until end of archive” (see Table 2-
4).
The complete time difference is first calculated in seconds and only then
converted to the time format “days:hours:minutes:seconds”. Formatting also
generates the leading zeros for number values larger than 10.
'Duration between Start an Stop in seconds:
Duration = DateDiff ("s",StartArchive.Read,StopArchive.Read)
'Split the Duration in days, hours, minutes and seconds:
DurationMin = Fix(Duration/60)
DurationSec = Duration - (DurationMin * 60)
DurationHour = Fix(DurationMin/60)
DurationMin = DurationMin -(DurationHour * 60)
DurationDay = Fix(DurationHour/ 24)
DurationHour = DurationHour - (DurationDay * 24)
'Creating leading zeros:
DurationSec = Right("00" & DurationSec,2)
DurationMin = Right("00" & DurationMin,2)
DurationHour = Right("00" & DurationHour,2)
 Siemens AG 2018 All rights reserved

DurationDay = Right("00" & DurationDay,2)


5. Use the archive name and the archive tag you want to read, the start time and the
calculated time difference to create the “CommandText”.
'Formating Starttime:
CommandTextStart = "'0000-00-" & DurationDay & " " &
DurationHour & ":" & DurationMin & ":" & DurationSec &
".000'"
'Building the complete String:
CommandText="Tag:R,'" & Archivename & "\" & MeasuringPoint &
"'," & CommandTextStart & ",'0000-00-00 00:00:00.000'"
6. Generate the command object and define the “CommandType”.
This is followed by the query with the previously generated CommandText. The
RecordSet is then set to the first data record in which the first acquired and
therefore oldest process value is stored.
'Create the recordset, read the records and set to first
‘recordset:
Set Command = CreateObject("ADODB.Command")
Command.CommandType = 1
Set Command.ActiveConnection = Conn
Command.CommandText=CommandText
Set RecSet = Command.Execute
RecSet.MoveFirst

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 23
2 Exporting archive data with WinCC

Note Please note: When using time and date in WinCC and Visual Basic, the date
format depends on the regional settings in Windows. The VBS code is designed
so that the date and time can be evaluated independently of these computer-
specific settings.
 Siemens AG 2018 All rights reserved

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 24
2 Exporting archive data with WinCC

Writing the *.csv file


The data records from the previously opened RecordSet are then written to the
*.csv file.

Table 2-6
No. Action
1. The subsequent loop writes the data sets (measuring point name, tag ID, time
stamp (UTC), process value) into the .csv file row by row. Before that, a row with the
column headers is generated once. This process considers the current Runtime
language setting (HMIRuntime.Language; 1031 = German, 1033 = English)
In each run, the RecordSet is set to the next data record.
'write recordsets To *.csv-File
'Header in *.csv-File
Language = HMIRuntime.Language
Select Case Language
Case 1031 'German = 1031
ts.WriteLine ("Tag-Name;ValueID;Datum/Zeit;Prozesswert")
'MsgBox "Tag-Name;ValueID;Datum/Zeit;Prozesswert"
Case 1033 'English = 1033
ts.WriteLine ("Tag-Name;ValueID;Date/Time;Process-Value")
 Siemens AG 2018 All rights reserved

'MsgBox "Tag-Name;ValueID;Date/Time;Process-Value"
End Select

Do While Not RecSet.EOF


ts.WriteLine (MeasuringPoint & ";" &
RecSet.Fields("ValueID").Value & ";" &
RecSet.Fields("TimeStamp").Value & ";" &
RecSet.Fields("RealValue").Value)
RecSet.MoveNext
Loop

Select Case Language


Case 1031 'German = 1031
MsgBox “Writing the file" & vbCrLf & “C:\Users\os\Documents\"
& "Osmosis_" & TimeStamp & "_" & MeasuringPoint & ".csv" &
vbCrLf & “successful!"
Case 1033 'English = 1033
MsgBox "Writing of File" & vbCrLf & "C:\Users\os\Documents\"
& "Osmosis_" & TimeStamp & "_" & MeasuringPoint & ".csv" &
vbCrLf & "successful!"
End Select

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 25
2 Exporting archive data with WinCC

No. Action
2. At the end of the script, the connection to the database is closed and the objects are
released.
' Close all
ts.Close
RecSet.Close
Set ReCset = Nothing
Set Command = Nothing
conn.Close 'Close connection
Set Conn = Nothing
Set fso = Nothing
Set f = Nothing
Set ts = Nothing
End Function
3. Save the script. The script is now available for calling.
 Siemens AG 2018 All rights reserved

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 26
2 Exporting archive data with WinCC

Calling the function in the process screen


For the call, the created “WriteArchiveValuesToCSV” function needs two
parameters: “Archivename” and “MeasuringPoint”.
The parameter “Archivename” corresponds to the name of the archive where the
tag to be read is located. In the current application example, this is the “Process
value archive”.
The “MeasuringPoint” corresponds to the name of the archive tag to be read; the
“QI900_ConductivityPermeatIn” tag is to be used as an example.
In the “ReverseOsmosis.Pdl” screen, the script is called using the associated
button.

Table 2-7
No. Action
1. Open the “Reverse_Osmosis.pdl” screen in the Graphics Designer.
2. Open the Properties dialog of the “Export Tags” button and select “Events -> Mouse
-> Mouse Click -> VBS-Action” to open the VBS editor.
 Siemens AG 2018 All rights reserved

3. Call up the script created before with the following code.


Sub OnClick(Byval Item)
Dim ArchiveName
Dim MeasuringPoint
ArchiveName = “Process value archive"
MeasuringPoint = "QI900_ConductivityPermeatIn"
Call WriteArchiveValueToCSV (ArchiveName, MeasuringPoint)
End Sub
4. Save the picture.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 27
2 Exporting archive data with WinCC

2.2.4 Script for exporting archived alarms

The startup and shutdown times and the stop time of the osmosis plant are entered
in the alarm archive as an operational message. Their alarm numbers are 1-3. In
this application example, the startup, shutdown and stop alarms of the last 24h are
to be written to a *.csv file.

The procedure essentially corresponds to writing measured value archives


(Chapter Fehler! Unbekanntes Schalterargument.) to a *.csv file. The only
differences are the structure of the RecordSet and the query of the data records.

Creating the VBS module

Table 2-8
No. Action
1. In the WinCC application example, start the global VBS editor.
 Siemens AG 2018 All rights reserved

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 28
2 Exporting archive data with WinCC

No. Action
2. Step 2 can be skipped if chapter Fehler! Unbekanntes Schalterargument. has
already been processed.
Select the “Project Modules” tab and create a new folder named
“WriteArchiveToCSV”.

3. In this folder, create a new project module.


 Siemens AG 2018 All rights reserved

4. Change the name of the procedure and save the project module as
“WriteArchiveMessagesToCSV”.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 29
2 Exporting archive data with WinCC

VBS code: Generating the *.csv file


In the first step of the VBS code, the “*.csv” file is saved in the “C:\Temp\” folder.
The file name is to be composed of the plant name, “Osmosis”, the start time of the
osmosis plant and the “Messages” extension.
For example: C:\Temp\Osmosis_15.02.2015 10:30:00_Messages.csv

Table 2-9
No. Action
1. Declare the following tags:
'Declaration of local Tags
Dim fso 'FileSystemObject
Dim f 'File
Dim ts 'TextStream
Dim path 'path
Dim StartTime 'Date and Time when writing is triggered
Dim TimeStamp 'Timestamp for bulding filename
2. Define the path and file name. The “path” tag contains the complete file name,
including the path in the following form:
C:\users\<UserName>\Documents\Osmosis_ + StartTime + _Messages.csv
Use the following code to read the current system time and set this time as the start
time. In the application example, the start time is used to generate the file name and
 Siemens AG 2018 All rights reserved

must first be converted to a suitable format.


'Date and Time when writing is triggered
StartTime = Now
'Generate String for the *.csv filename and replace ":" with
"_"
TimeStamp = FormatDateTime(StartTime, vbGeneralDate)
TimeStamp = Replace(TimeStamp,":", "_")
'Path and name for the *.csv file
path ="C:\Temp\" & "Osmosis_" & TimeStamp & "_Messages.csv"

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 30
2 Exporting archive data with WinCC

No. Action
3. Then, use the following code to generate the file system object (fso) and the file
object (f) using the previously formed path and file name (path). Before doing so,
the system checks whether the file already exists and, if this is the case, processing
the function is terminated after displaying a message.
'Create FileSystemObject and *.csv file if it not exist:
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FileExists(path) Then
fso.CreateTextFile(path)
Else
MsgBox "File already exist:" & vbCrLf & path
Exit Sub
End If
Then the .csv file opens with the TextStream object (ts) for writing.
'Create File-Object and open this File
Set f = fso.GetFile(path)
Set ts = f.OpenAsTextStream(2,-2)
'iomode = 2, Writing
'format = -2, TristateUseDefault
'*.csv-File is now ready for Writing
 Siemens AG 2018 All rights reserved

Connection to the database


The second step of the sub-procedure establishes the connection to the database
using the WinCC OLE DB Provider. At least one of the following items is required
for the connection.
 The archive to be read is part of a WinCC Runtime
project.
 The archive to be read is connected in SQL Manager via “Attach Database”.
 The archive to be read is connected via the “Archive Connector”.

A set of SQL commands is created to query the alarm archive data. A message
archive data record is structured according to Fehler! Unbekanntes
Schalterargument.. The field names can be accessed directly in the SQL query.

Table 2-10
FieldNo. Field name Type Meaning
1 MsgNr (4-byte) integer Alarm number
2 State Small 2-byte integer Status of the message
3 DateTime 8-byte DateTime Time stamp of the alarm (date,
time without milliseconds)
4 Ms Small 2-byte integer Time stamp of the alarm
(milliseconds)
5 Instance VarChar(255) Instance name of the alarm
6 Flags1 4-byte integer (For internal use only)
7 PValueUsed 4-byte integer Process values used
8-17 PValue1 to 8-byte real Numerical process value 1 to 10
PValue10
18-28 PText1 to PText10 VarChar(255) Process value text 1 to 10

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 31
2 Exporting archive data with WinCC

FieldNo. Field name Type Meaning


28 Computername VarChar(255) computer name
29 Application VarChar(255) Application name
30 Comment VarChar(255) Comment
31 Username VarChar(255) User name
32 Counter 4-byte integer Continuous alarm counter
33 TimeDiff 4-byte integer Time difference for the
“incoming” status
34 Classname VarChar(255) Alarm class name
35 Typename VarChar(255) Alarm type name
36 Class Small 2-byte integer Alarm class ID
37 Type Small 2-byte integer Alarm type ID
38 to 47 Text1 to Text10 VarChar(255) Alarm text 1 to 10
48 AG_NR Small 2-byte integer Number of the programmable
controller
49 CPU_NR Small 2-byte integer Number of the CPU

50 CrComeFore 4-byte integer Foreground color for the


“incoming” status
51 CrComeBack 4-byte integer Background color for the
“incoming” status
 Siemens AG 2018 All rights reserved

52 CrGoFore 4-byte integer Foreground color for the


“outgoing” status
53 CrGoBack 4-byte integer Background color for the
“outgoing” status
54 CrAckFore 4-byte integer Foreground color for the
“acknowledged” status
55 CrAckBack 4-byte integer Background color for the
“acknowledged” status
56 LocaleID 4-byte integer Location of the alarm
57 Priority 4-byte integer Priority
58 AP_type 4-byte integer Loop in Alarm
59 AP_name VarChar(255) Loop in Alarm function name
60 AP_PAR VarChar(255) Loop in Alarm screen
61 InfoText VarChar(255) info text
62 TxtCame VarChar(255) Text came
63 TxtWent VarChar(255) Text went
64 TxtCameNWent VarChar(255) Text came and went
65 TxtAck VarChar(255) Text acknowledged
66 AlarmTag 4-byte integer Alarm tag
67 AckType Small 2-byte integer Acknowledgment type
68 Params 4-byte integer Parameter
69 Server name VarChar(255) Server name

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 32
2 Exporting archive data with WinCC

Establishing the connection


To establish the connection to the database, a connection object must be
generated and the “ConnectionString” must be transferred. The “ConnectionString”
requires the following parameters:
 The provider name
 The provider instance number
 The user data source name (DSN, GUID of the WinCC project)
 WinCC as a data source, including the computer name

General format of the “ConnectionString”:


ConnectionString =
“Provider=<ProviderName>.<InstanceNo.>;Catalog=<DSNofDatabase>R;Data
Source=<ComputerName>\WinCC”

Note Access is also possible without specifying the computer name (.\WinCC).
However, this means lower-performance access.
For transparent access, enter the WinCC project name for “Catalog”, e.g.
“Catalog=WinCC_Project_Name”.

Querying the data


 Siemens AG 2018 All rights reserved

To query the data, a command object is generated to which a “CommandText” is


then transferred for processing. The “CommandText” contains the following data:
 One command set (ALARMVIEWEX:Select)
 The name of the database table (ViewName)
 The condition (Condition)

General format of the “CommandText”:


CommandText = “<CommandSet> * FROM <NameOfDatabaseTable> WHERE
<Condition>”

Table 2-11
Parameter Description
ViewName Name of the database table. The table must be specified in the desired
language. For example, the “ViewName” for the five
European languages is:

ALGVIEWEXDEU: German alarm archive data


ALGVIEWEXENU: English alarm archive data
ALGVIEWEXESP: Spanish alarm archive data
ALGVIEWEXFRA: French alarm archive data
ALGVIEWEXITA: Italian alarm archive data

The “ViewName” for the Asian languages is:


ALGVIEWEXCHS: Chinese (simplified) alarm archive data
ALGVIEWEXCHT: Chinese (traditional) alarm archive data
ALGVIEWEXJPN: Japanese alarm archive data
ALGVIEWEXKOR: Korean alarm archive data

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 33
2 Exporting archive data with WinCC

Parameter Description
Condition Indicates the condition(s) for querying the message archive.
Examples of queries:
DateTime>'2003-06-01' AND DateTime<'2003-07-01'
DateTime>'2003-06-01 17:30:00'
MsgNr = 5
MsgNr in (4, 5)
State = 2

Note
Only absolute time values can be used for DateTime.
Example:
The “CommandText” reads all German entries of alarm number 5 acquired after
01.01.2016:
“ALARMVIEWEX:Select * FROM ALGVIEWEXDEU WHERE MsgNr=5 and DateTime >
‘2016-01-01’”

UNICODE is supported by WinCC V7.2 or higher. Therefore, archive access of


Note
alarms has changed. Older WinCC versions (<V7.2) access the alarm archive
using ALARMVIEW (instead of ALARMVIEWEX).

Simultaneous query of multiple conditions is possible. This requires that strings


 Siemens AG 2018 All rights reserved

be &-ed. Condition enumeration using “AND”, e.g..:


CommandText = "<CommandSet> * FROM <LanguageSetting> WHERE“ &
“<Condition 1>” & “AND <Condition 2>“ & “AND <Condition 2>”

The languages installed in the WinCC basic system or configured in the WinCC
Text Library are supported. Information on the possible query languages or the
respective “ViewName” is available in the SQL server in the connected alarm
archives in “Views”. “Views” displays all languages with their IDs, e.g.
“ALGVIEWEXENU”, that are supported in the respective archive.

Note The start and stop times can be transferred as absolute or relative values (see
Fehler! Unbekanntes Schalterargument.).

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 34
2 Exporting archive data with WinCC

Establishing the connection and querying the data

Table 2-12
No. Action
1. Declare the other tags:
'Declaration of Script Tags
Dim Pro 'Provider
Dim DSN 'Data Source Name
Dim DS 'Data Source
Dim ConnString 'Connection String
Dim MachineNameRT 'Name of the PC from WinCC-RT
Dim DSNRT 'Data Source Name from WinCC-RT
Dim Conn 'Connection to ADODB
Dim CommandText 'Command-Text
Dim SqlSec 'Duration of Production-Cycle
Dim SqlMin 'Duration of Production-Cycle
Dim SqlHour 'Duration of Production-Cycle
Dim SqlDay 'Duration of Production-Cycle
Dim SqlMonth 'Duration of Production-Cycle
Dim SqlYear 'Duration of Production-Cycle
 Siemens AG 2018 All rights reserved

Dim RecSet 'RecordSet


Dim Command 'Query
Dim Language 'Language Tag
2. Use the following code to read the computer name and the GUID of the project from
the environment tags “@LocalMachineName” and “@DataSourceNameRT” into the
previously declared local tags.
'Read the name of the PC-Station and the DSN-Name from
'WinCC-RT
Set MachineNameRT = HMIRuntime.Tags("@LocalMachineName")
Set DSNRT = HMIRuntime.Tags("@DatasourceNameRT")
Create the “ConnectionString” with the aid of these tags.
'Preparing the Connection-String
'First instance of WinCCOLEDB
Pro = "Provider=WinCCOLEDBProvider.1;"
'Name of Runtime-Database
DSN = "Catalog=" & DSNRT.Read & ";"
'Data Source
DS = "Data Source=" & MachineNameRT.Read & "\WinCC"
'Build the complete String:
ConnString = Pro + DSN + DS
3. Then establish the connection to the database.
'Connection based on ODB-Provider
Set Conn = CreateObject("ADODB.Connection")
Conn.ConnectionString = ConnString
Conn.CursorLocation = 3
Conn.open

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 35
2 Exporting archive data with WinCC

No. Action
4. The “CommandText” is required to query the data in the WinCC database.
This example records the previously saved start time of the query (selection of the
button). This time must be reformatted to “YYYY-MM-DD hh:mm:ss”.
Here, too, the leading zeros for number values smaller than 10 must be generated
when formatting.
'FormatStarttime for SQL command
‘Format needed for StartTime: yyyy-mm-dd hh:mm:ss
'Date and time 24 hours before
StartTime = DateAdd("h", -24, StartTime)
'Split in years, months, days, hours, minutes, seconds
SqlSec = Second(StartTime)
SqlMin = Minute(StartTime)
SqlHour = Hour(StartTime)
SqlDay = Day(StartTime)
SqlMonth = Month(StartTime)
'Creating leading zeroes
SqlSec = Right("00" & sqlSec,2)
SqlMin = Right("00" & sqlMin,2)
SqlHour = Right("00" & sqlHour,2)
SqlDay = Right("00" & sqlDay,2)
 Siemens AG 2018 All rights reserved

SqlMonth = Right("00" & sqlMonth,2)


SqlYear = Right("00" & sqlYear,2)
'Create string
StartTime = "'" & SqlYear & "-" & SqlMonth & "-" & SqlDay & "
" & SqlHour & ":" & SqlMin & ":" & SqlSec & "'"
5. The complete query is represented in the “CommandText” tag for further
processing.
In this example, all alarms with an alarm no. < 4 saved in the alarm archive are
read. If the Runtime language is set to German (HMIRuntime.Language=1031),
“ALGVIEWEXDEU” is entered for the “ViewName” parameter. If the active Runtime
language is English (HMIRuntime.Language=1033), “ALGVIEWEXENU” is selected.
'Building the complete string
Language = HMIRuntime.Language
Select Case Language
Case 1031 'German = 1031
CommandText="ALARMVIEWEX:Select*FROM ALGVIEWEXDEU WHERE
DateTime >" & StartTime& "MsgNr< 4 AND STATE = 1"
Case 1033 'English = 1033
CommandText="ALARMVIEWEX:Select*FROM ALGVIEWEXENU WHERE
DateTime >" & StartTime& “MsgNo< 4 AND STATE = 1"
End Select

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 36
2 Exporting archive data with WinCC

No. Action
6. Then the command object is generated and the query is executed with the
previously generated CommandText.
The RecordSet is set to the command object and then set to the first data record in
which the first acquired and therefore oldest alarm is stored.
'Create the recordset, read the records and set the first
recordset:
Set Command = CreateObject("ADODB.Command")
Command.CommandType = 1
Set Command.ActiveConnection = Conn
Command.CommandText = CommandText
Set RecSet = Command.Execute
RecSet.MoveFirst

Note Please note: When using time and date in WinCC and Visual Basic, the date
format depends on the current regional settings in Windows. The VBS code
should be designed so that the date and time can be evaluated independently of
these computer-specific settings.
 Siemens AG 2018 All rights reserved

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 37
2 Exporting archive data with WinCC

Writing the *.csv file


The data records from the previously opened RecordSet are then written to the
*.csv file.

Table 2-13
No. Action
1. The data records are written with the following loop. In the example, the following
Recordset fields are read from the data record and written to the *.csv file.
 DateTime (time stamp)
 MsgNr (alarm number)
 Text1 (event text 1)
 Classname (alarm class)
 Type name (alarm type)
Before that, a row with the column headers is generated once; this process, too,
considers the currently set Runtime language.
In each run, the RecordSet is set to the next data record.
'write recordsets To *.csv-File
'Header in CSV file
Language = HMIRuntime.Language
Select Case Language
Case 1031 'German = 1031
 Siemens AG 2018 All rights reserved

ts.WriteLine
("Datum/Zeit;Meldenr.;Ereignis;Meldeklasse;Meldetyp")
Case 1033 'English = 1033
ts.WriteLine (“Date/Time;MsgNo.;Event;Messages Class;Messages
Type")
End Select

'writing recordsets
Do While Not RecSet.EOF
ts.WriteLine(RecSet.Fields("DateTime").Value & ";" &
RecSet.Fields("MsgNr").Value & ";" &
RecSet.Fields("Text1").Value & ";" &
RecSet.Fields("Classname").Value & ";" &
RecSet.Fields("Typename").Value)
RecSet.MoveNext
Loop

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 38
2 Exporting archive data with WinCC

No. Action
2. At the end of the script, the connection to the database is closed and the objects are
released.
' Close all
ts.Close
RecSet.Close
Set RecSet=Nothing
Set Command = Nothing
conn.Close 'Close connection
Set Conn = Nothing
Set fso = Nothing
Set f = Nothing
Set ts = Nothing
3. Save this script.
4. Then the script is available for calling. The script does not required any parameters.

Calling the function in the process screen


For the call, the created “WriteArchiveMessagesToCSV” procedure does not
require transfer parameters. In the “ReverseOsmosis.Pdl” screen, the script is
called using the associated button.
Table 2-14
 Siemens AG 2018 All rights reserved

No. Action
1. Open the “ReverseOsmosis.pdl” screen in the Graphics Designer.
2. Open the Properties dialog of the “Export Messages” button and select “Events ->
Mouse -> Mouse Click -> VBS-Action” to open the VBS editor.

3. Create the following code for calling the previously created VBS script:
Sub OnClick(ByVal Item)
WriteArchiveMessagesToCSV
End Sub
4. Save the picture.

Note The “WriteArchiveMessageToCSV” function can alternatively also be called up


automatically, by creating an action in the VBS editor which is called time- or tag-
triggered.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 39
2 Exporting archive data with WinCC

2.3 Operation
2.3.1 Export of archived tags using VBS script

Table 2-15
No. Action Remarks
1. Start Runtime.

2. Click the “Reverse-Osmosis” button to open the


“ReverseOsmosis.pdl” screen.
3. In this screen, use the “STARTUP” button in the left-hand side
of the control panel to start the reverse osmosis plant.
4. Wait until the plant has reached the “Production” status.

5. After a short operating time, select the “SHUTDOWN” button


to shut down the plant.
6. After the plant has reached the “Off” status and the stop time
has been automatically entered in “Stop”, select the “Export
Tags” button.
7. Then open the *.csv file created under “C:\Temp\”.
 Siemens AG 2018 All rights reserved

2.3.2 Export of archived alarms using VBS script

No. Action Remarks


1. Start Runtime.

2. Click the “Reverse-Osmosis” button to open the


“ReverseOsmosis.pdl” screen.
3. In this screen, use the “STARTUP” button in the right-hand
side of the control panel to start the osmosis plant.
4. Wait until the plant has reached the “Production” status.

5. After a short operating time, select the “SHUTDOWN” button


to shut down the plant.
6. After the plant has reached the “Off” status and the stop time
has been automatically entered in “Stop”, select the “Export
Alarms” button.
7. Then open the *.csv file created under “C:\Temp\”.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 40
3 Exporting archive data with Excel

3 Exporting archive data with Excel


3.1 Mode of operation - overview
 Data access to the Runtime archive is achieved with VBS scripts in Excel.
 The archive data are exported to an Excel client.

Note The Excel client is designed as an Excel file and is contained in the application
example as a download.

Figure 3-1
 Siemens AG 2018 All rights reserved

WinCC/Connectivity Pack
OLE DB Provider
*.XLS
Excel Client

Archive

Projekt Daten Runtime Daten

This Excel file is a simple tool with which the user can access the process values
and message data archived by WinCC to export it to Excel.

Range of functions
 Reading out the data from the WinCC Runtime database of an OS server or a
SIMATIC Process Historian
 Individual compiling of the process values and message information
 Possibility of interpolation for missing values (process values)
 Adjustable time intervals (process values)
 Accessing the archives of different languages (messages)
 Using filters such as time interval and message type (messages)
 Interpreting the wildcards in the message texts (messages)

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 41
3 Exporting archive data with Excel

Note The Excel client is designed for universal use. In this application example, the
reverse osmosis plant serves an exemplary data source.
However, any WinCC archive of any computer can be used as a data source.
To open the script editor of the Excel client, press <Alt> + <F11>.

3.2 Mode of operation - details


This chapter provides information that makes it easier to expand the “Alarms” tab
of the existing application or to better adapt it to your individual requirements.

Note This chapter is only relevant to you if you are interested in the software
implementation or if you want to make changes to the application.
Basic knowledge of VBA programming is assumed.

3.2.1 The SQL command

This section will help you understand the function of the SQL command for reading
out the data. If you have basic knowledge of programming in VBA and the SQL
 Siemens AG 2018 All rights reserved

database language, reading this section will enable you to expand the application
in different points if necessary.

Note The SQL command used here contains a modification that is especially required
for communicating with the WinCC OLE DB Provider. Due to this, the command
partly differs from the specified standard.

Parts of the SQL command


An example explains the parts of the SQL command and illustrates how the SQL
command is composed at full length. The description mainly focuses on showing
the variable parameters.
The following points describe in greater detail how these variable parameters are
defined.

SQL example
The example below shows an SQL command that uses all filter options of the
application.
"ALARMVIEW: SELECT TOP 65000 * FROM AlgViewEnu WHERE DateTime >
'2009-3-17 0:0:0' AND DateTime < '2009-3-17 23:59:59' AND (CLASS = 1
OR CLASS = 10) AND (Text2 = 'WEIGHT' OR (Text2 = '@2%s@' AND PText2
= 'WEIGHT') ) ORDER BY DateTime ASC"

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 42
3 Exporting archive data with Excel

Explanation of the command elements


To enable you to better understand the different elements of the command, the
table below explains them in detail.

Table 3-1
1 2
Command element Description Var Opt
ALARMVIEW: The relevant database is the one for Alarmview (provider- (-) (-)
specific supplement).
SELECT * All data fields (columns) in the table or view still to be (-) -
defined are required.
TOP 65000 The number of messages returned by the query is 65000. (-) (-)
FROM AlgViewEnu The data records are located in the x -
“AlgViewEnu” view.
This name contains several pieces of information:
 Alg: Prefix for AlarmLogging
 View: View (not a table).
 Enu: The alarms of the English configuration.
Note:
Unlike a table, a view does not contain data records. It
merely compiles the desired information by means of
references to different tables.
WHERE DateTime > The required messages have occurred in the specified x (-)
 Siemens AG 2018 All rights reserved

'2009-3-17 0:0:0' period (UTC).


AND DateTime < Note:
'2009-3-17 23:59:59' The conversion from local time to UTC and back is
automatically performed by the application.
AND (CLASS = 1 Messages of the “Alarm” (coded as class 1 within the x x
OR CLASS = 10) database) and “Operator Message” type (class 10) are
required.
AND (Text2 = Only messages are returned that have been generated in x x
'WEIGHT' …) the plant area (internally directly stored in “Text2” or from
there referenced to associated value “PText2”) with the
configured name “WEIGHT”.
ORDER BY DateTime The messages are sorted in ascending order by their date (-) (-)
ASC of generation.

1
Does the command element change depending on the settings made?
2
Can the element, irrespective of the made settings, be left out?
x – Yes
- – No
(-) – No (relating to the application in unchanged form)

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 43
3 Exporting archive data with Excel

Adding alarm languages


In this application, you can select between the archived messages in five different
languages. However, since WinCC is used worldwide, it is possible that you want
to access messages in additional languages.
This section describes how the language selection is currently realized and how
you can adapt it to your specific requirements if necessary.
It cannot be ensured that the procedure described below is successful in every
case. This depends primarily on whether the name and the structure of the view
associated with the language corresponds to the structure of the languages that
have already been implemented.

Overview
To change the message language, the user proceeds as described in Fehler!
Unbekanntes Schalterargument.. The language is selected by means of the
“Language” drop-down list the application requests when creating the SQL
command.
The following table provides an overview of the currently available languages, the
associated entries in the drop-down list and the names of the respective views.

Table 3-2
Language Drop-down list entry View name
German German AlgViewDeu
 Siemens AG 2018 All rights reserved

English English AlgViewEnu


French Français AlgViewFra
Italian Italiano AlgViewIta
Spanish Español AlgViewEsp

Explanation
As you see in the above overview, the view names differ only in their last three
letters that are used to define the message language.
In addition, it becomes clear that the first three letters of the drop-down list entries
correspond to the last three letters of the view names in almost all cases.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 44
3 Exporting archive data with Excel

Procedure
To create the SQL statement in the required form, the following code is used
(VBAProject -> Microsoft Excel Objects -> Sheet2 -> cmdAlarmRead_Click):

'Select all columns


strSQL = "ALARMVIEW: SELECT * FROM AlgView"
'Select the table according to the project language
If Left(cmbAlarmLang.Text, 3) = "Eng" Then
strSQL = strSQL & "Enu"
Else
strSQL = strSQL & Left(cmbAlarmLang.Text, 3)
End If

After assigning the constant part of the SQL command, it is checked whether the
selected entry in the drop-down list starts with “Eng”. If this is the case, “Enu” is
added to the command. Otherwise, the first three letters of the drop-down list entry
are added.
 Siemens AG 2018 All rights reserved

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 45
3 Exporting archive data with Excel

Adding a language
To add a message language to the existing selection, proceed as follows:

Table 3-3
Step Description
1. Expanding the drop- To expand the drop-down list, edit the initialization
down list statements in the “VBAProject -> Microsoft Excel Objects
-> ThisWorkBook -> Workbook_Open” module.
Add an additional command line in the format
cmbAlarmLang.AddItem "English” to the existing ones.
2. Checking the Use your SQL Server Management Studio to determine
identifiers the name of the view associated with this language.
3. Case 1: No further If the first three letters of your drop-down list entry
change necessary correspond to the last three letters of the view name, no
further change is required.
4. Case 2: Extending the If the letters differ, extend the if command in the code
if command excerpt presented above by a suitable ElseIf element.

Adding message types


This version of the application is capable of filtering the archived messages by up
 Siemens AG 2018 All rights reserved

to six different message types.


In WinCC, however, another seven message types exist in addition to these six
types. Furthermore, you have the option of creating your own message types.
It may thus be required that the filter be extended by these message types.
As in the previous section, this section first presents the current implementation
and subsequently shows an option to change it.

Overview
Using the filter for message types has already been described in detail in Fehler!
Unbekanntes Schalterargument.. With the aid of the option box, the individual
types are selected and added to the SQL command when creating it.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 46
3 Exporting archive data with Excel

Procedure
The following code realizes the necessary expansion of the SQL command
“VBAProject > Microsoft Excel Objects > Sheet2 >
cmdAlarmRead_Click“:
'Apply filter
If chkAlarmAlarms.Value = True Or _
chkAlarmWarnings.Value = True Or _
chkAlarmASPLCMessages.Value = True Or _
chkAlarmOSPLCMessages.Value = True Or _
chkAlarmOperatingMessages.Value = True Or _
chkAlarmSystemMessages.Value = True Then

'Flag to signalize that a part of the filter has


already been entered
'Depending on the flag, further parts of the filter
will be added in a different format
Dim boolIsFirst As Boolean
boolIsFirst = True

'If EventCategories are filtered a prefix is


necessary
strSQL = strSQL & "AND ("
 Siemens AG 2018 All rights reserved

If chkAlarmAlarms.Value = True Then


strSQL = strSQL & "CLASS = 1"
boolIsFirst = False
End If
If chkAlarmWarnings.Value = True Then
If Not boolIsFirst Then
strSQL = strSQL & " OR CLASS = 2"
Else
strSQL = strSQL & "CLASS = 2"
boolIsFirst = False
End If
End If
(…)
If chkAlarmSystemMessages.Value = True Then
If Not boolIsFirst Then
strSQL = strSQL & " OR CLASS = 18"
Else
strSQL = strSQL & "CLASS = 18"
boolIsFirst = False
End If
End If

'If EventCategories are filtered a suffix is


necessary
strSQL = strSQL & ") "
End If

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 47
3 Exporting archive data with Excel

The program flowchart shown in Figure 3-2 describes the structure of the above
code excerpt. In the application, the area silhouetted in gray is executed once for
each filterable message type, except for the alarms. To improve clarity, this
representative section is included only once.

Figure 3-2

Start

Is
No
filter selected
?
Yes
boolIsFirst = True
Append prefix to strSQL

Are Yes Append string to strSQL


alarms filtered
? boolIsFirst = False
 Siemens AG 2018 All rights reserved

No
Is
No
element selected
?
Yes

boolIsFirst No Append string2 to strSQL


= False boolIsFirst = False
?
Yes
Append string1 to strSQL

Add suffix to
strSQL

End

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 48
3 Exporting archive data with Excel

Adding a language
To extend the filter elements by an additional message type, follow the instructions
listed in the table below:

Table 3-4
Step Description
1. Unprotecting the Before you can insert the control element necessary for the
sheet extension, you have to remove the Excel sheet protection.
How this is done depends on the version and is described in
the Excel help.
2. Inserting control Insert an additional option box to the already existing ones
element and enter a representative name for it.

Note:
To avoid layout problems, separate the position and size
properties of the control element from the cell properties:
1. Open the “Format -> Control…” menu option.
2. Go to the “Properties” tab.
3. Select “Dont move or size with cells”.
4. Confirm the changes.
3. Extending the Extend the code section shown above by an element of the
source code form:
 Siemens AG 2018 All rights reserved

If chkAlarmSystemMessages.Value = True Then


If Not boolIsFirst Then
strSQL = strSQL & " OR CLASS = 18"
Else
strSQL = strSQL & "CLASS = 18"
boolIsFirst = False
End If
End If

When doing so, change the option box name and the
message type number.
Add the respective condition to the
(If chkAlarmAlarms.Value = True Or …)
higher-level query
(… Or chkAlarmSystemMessages.Value = True …).

Note:
With the aid of SQL Server Management Studio, you find an
overview of the coding of the message types used in the
current project.
1. When starting the application, select your WinCC server.
2. Navigate to the following table (example):
“Databases > CC_OS_1__09_03_19_18_33_31 > Tables
> dbo.MSMsgGroup”
3. For the relevant coding from the “GROUPDAT” column,
refer to this table. The relevant entries are of “TYPE 3”.
4. Protecting the Protect the sheet again. How this is done depends on the
sheet version and is described in the Excel help.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 49
3 Exporting archive data with Excel

3.2.2 Expansion capability of the message structure

Problem
This application provides the option of displaying all message information
(columns) that is also available in WinCC. However, the archived messages
contain additional information such as “AlarmTag”, “AckType” and “Servername”
that cannot be selected with these settings.
To facilitate understanding, the current implementation is explained first. Based on
this explanation, you are then provided with step-by-step instructions on how the
message structure can be adapted.

Overview
The procedure for adapting the message structure has already been described in
detail in Fehler! Unbekanntes Schalterargument.. The settings are made in a
separate window. After confirming the changes, the workspace of the application is
automatically adjusted.
 Siemens AG 2018 All rights reserved

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 50
3 Exporting archive data with Excel

Procedure
The message structure influences the application in most different areas. For the
expansion, it is merely important to know how the necessary basic information is
initialized. All further sequences adapt to the respective settings (as long as they
correspond to the program logic).
Three arrays form the basis for the message structure:

Table 3-5
Array Content
strAlarmDataNames Contains the names that are displayed to the user for
selection. The current entries correspond to the names that
are also used when editing the WinCC message structure
in Graphics Designer.

Note:
These names differ from the ones used in the database.
They are used to provide the user with an intuitive
understanding.
intAlarmRecordSetID Contains the position of each piece of message information
of the record set.

Note:
 Siemens AG 2018 All rights reserved

After requesting the messages via the SQL command, they


are returned as a record set.
The structure of a record set is always identical as long as
neither the data source (the view) nor the queried structure
(SELECT *) change. Due to this fact, each piece of
information in this record set has a fixed position.
dblAlarmColumnWidth Contains the column width assigned to a piece of message
information by default.

Note:
When adapting the message structure, the width of the
assigned column is automatically adjusted for each
selected piece of message information (see Fehler!
Unbekanntes Schalterargument.). This is done to ensure
optimum display of the messages.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 51
3 Exporting archive data with Excel

The declaration of the arrays is made with the aid of a constant so that a uniform
structure can be ensured: “VBA-Project -> Modules -> MngAlarmPositions”:
Public strAlarmDataNames(1 To MAX_ALARM_DATA_COLUMNS) As String
This constant corresponds to the number of pieces of message information which
is 38 by default.
The response of the arrays, e.g. during their initialization, occurs via further
constants of which each one corresponds to one message information respectively
“VBA-Project -> Modules -> MngAlarmPositions -> InitializeAlarmArrays”:
strAlarmDataNames(C_DATE_TIME) = "Date / Time"
This improves the readability of the source code and simplifies making changes.

According to their function as an index of the arrays, the constants for the message
information include consecutive numbers “VBA-Project -> Modules -> Constants”
for jointly used constants or “VBA-Project -> Modules -> ConstantsAlarm” for
alarm-specific constants:
Public Const C_DATE_TIME = 1
Public Const C_MS = 2
Public Const C_PRIORITY = 3
The pieces of standard information are sorted according to their sequence in
WinCC Graphics Designer.

Expanding the message structure


 Siemens AG 2018 All rights reserved

Expanding the message structure merely requires that the constants and array
initializations be adapted. To do this, proceed as described in the following table:

Table 3-6
Step Description
1. Adapting the In “VBA-Project -> Modules -> ConstantsAlarm”, enter the
maximum value number of
constant pieces of message information for the MAX_DATA_COLUMNS
constant.

Note:
Via the constant, the application adjusts to the changed
conditions. A correct value for this constant is thus essential.
2. Adding the index In the same module, add as many constants as required to
constants the already existing index constants (e.g., C_PRIORITY).

Note:
Ensure that the new numbers are consecutive and that the
value defined in MAX_ALARM_DATA_COLUMNS is not
exceeded.
3. Extending the The presented arrays are initialized in the “VBA-Project ->
array initialization Modules -> MngPositions -> InitializeArrays” module.
Insert as many elements into each of the three arrays as
pieces of message information you want to add and fill them
with the associated data (see Fehler! Unbekanntes
Schalterargument.).

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 52
3 Exporting archive data with Excel

3.3 Configuration and Settings


3.3.1 First call of the application

Storage location
The application does not have to be installed separately. Copy the “OLE-DB Tag
and Alarm Export_V9.xls” file directly to your desired location. The Excel file
contains the entire source code in the form of macros that are run in the
background.

Calling up the application


Start the application by double-clicking on the Excel file.
Depending on your Excel settings, the following warning may appear as soon as
the application has opened:

Figure 3-3
 Siemens AG 2018 All rights reserved

The reason for this warning is that your macro security level is set to “High”.
Change it if required.

3.3.2 Setup of the application window

Overview
Fehler! Unbekanntes Schalterargument. and Fehler! Unbekanntes
Schalterargument. show the application after it has been opened. Which interface
is displayed depends on which tab was active during the last storing process. The
entries are also those available when it was last saved.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 53
3 Exporting archive data with Excel

Figure 3-4

Figure 3-5
 Siemens AG 2018 All rights reserved

Note The user interface is completely in English.


The selection in the “Alarm Language” drop-down list of the “Alarms” tab refers
to the language of the messages to be read out.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 54
3 Exporting archive data with Excel

You can switch between “Tags” and “Alarms” by selecting the respective tab at the
bottom edge of the Excel window.

Figure 3-6
 Siemens AG 2018 All rights reserved

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 55
3 Exporting archive data with Excel

Workspace structure
Representing both tabs the structure of the workspace is illustrated here as the
“Alarms” tab.

Figure 3-7
 Siemens AG 2018 All rights reserved

Each of the three selected sections performs its own function, which is described in
the following Fehler! Unbekanntes Schalterargument..

Table 3-7
Area Function
Toolbar All required settings are made using the toolbar. These
settings include the selection of the data source and the
definition of message filter or process filter.
For a more detailed description of this section, please refer to
Fehler! Unbekanntes Schalterargument..
Column Headers The column headers define the structure of the displayed
messages.
Note:
You can adapt both the sequence and the structure as
desired. The exact procedure is described in Fehler!
Unbekanntes Schalterargument..
Messages This section contains the read out messages or process
(“Tags” tab: values with your selected structure.
process values)

Note The boxes of the “Toolbar” and “Column Headers” sections are protected to
avoid unintended changes. To ensure that the application’s operating capability
remains unaffected, we recommend that this protection be left unchanged.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 56
3 Exporting archive data with Excel

3.3.3 Toolbar design

In the toolbar, you make all settings that are necessary to display your desired data
in a format of your choice. The design of the toolbar can be subdivided into three
sections (illustrated in Fehler! Unbekanntes Schalterargument. as an example
for the “Alarms” tab):
 The basic settings which – once they have been set – remain unchanged for
the entire session in most cases
 The filter which allows to describe the required archive data in greater detail
and to thus improve the search result
 The action section from which the adaptation of the structure of the displayed
messages (selection of the message blocks) or process values (selection of
static values) and the actual read action can be started.

Each of these sections includes several control elements that are described in
greater detail later in the instructions for operating the application in 3.4.

Figure 3-8
 Siemens AG 2018 All rights reserved

3.3.4 Table view

The representation of the received archive data varies and enables you to define a
structure which is ideal for you. For process values different static functions can be
executed for example, and their results be displayed.
The table view for displaying the messages is based on the journal list of the
WinCC alarm system. Similar to the original, the display of the different message
blocks can be designed individually (see Fehler! Unbekanntes
Schalterargument.).

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 57
3 Exporting archive data with Excel

3.4 Operation
This section describes how process values and messages can be read out from
the archive. With the exception of the explanation of the filter, this is performed
exemplary at the procedure for messages, since the treatment of process values
differs very little.

3.4.1 Calling up the application

Table 3-8
No. Description
1. Start the application.

Note:
After starting the application, it is possible that it does not respond for a short
period of time. This is due to the fact that the network is busy and that the listing of
available computers progresses only slowly.

If several subnets exist, only members of the own work group are determined.
Nevertheless, you can also access computers which are not displayed, as long as
there is a valid connection to them.
You only need to enter the name of the target computer into the text field of the
dropdown menu “Host”.
2. If required, enable macros.
 Siemens AG 2018 All rights reserved

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 58
3 Exporting archive data with Excel

3.4.2 Editing Default settings

In the basic settings, you make settings that in most cases remain identical for the
entire session. This includes defining the source computer and the message
language.

Table 3-9
Description Control element
1. Select the “Alarms” tab.

2. In the “Host” drop-down list, select the


computer that serves as a source of
information.
After starting the program, the name of the
calling computer is entered.

Note:
It is required that WinCC Runtime be started
on the computer specified here since the
WinCC OLE DB Provider communicates with
its services.
In addition, it must be observed that only the
data is read that is locally available on this
 Siemens AG 2018 All rights reserved

computer. If you are using a CAS (Central


Archive Server), you have to select between
this server (long-term archive) and the OS
server (short-term archive) to receive the
messages of a specific time range.
3. In the drop-down list, select the language in
which the messages to be exported were
configured.
The following languages are available:
 German
 English
 French
 Italian
 Spanish

Note:
The language selection is not available for
process values.

If one of these message languages is not


configured separately, the messages of this
language contain the standard texts.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 59
3 Exporting archive data with Excel

3.4.3 Editing filter settings

The filter settings enable you to reduce the returned archive data to the ones you
are actually interested in with regard to tag, time range, time interval (process
values) or time, type and origin (messages). Differences between the procedure for
process values and messages are explained in parallel steps.

Table 3-10
Description Control element
1. In the two input boxes, define the time range
in which the archive data you are searching
for has occurred.
Ensure that the start time is before the end
time.
By default, the current date from 0 - 24 h is
set.

Note:
Time and date have to be entered in a
specific form:
YYYY-MM-DD hh:mm:ss
In addition, it must be ensured that the input
is intrinsically logical (e.g., no February 30, no
70 minutes or similar inputs). If the value is
 Siemens AG 2018 All rights reserved

invalid when exiting the input field, a warning


will appear and the previously entered value
is restored.
2. For the “Tags” tab:
Click on the “Read Tags” / “Areas” button
for reading the archived process values (tags)
or the configured (plant) areas.

Note:
To be able to perform reading, the relevant
host must have previously been selected.
Error handling:
If the following message is displayed,
communication with the database has failed:
“Area” / “Tag determination failed” + error
description.
Possible causes are:
 Network problems (host not accessible)
 Insufficient access rights (same user and
same passwords required)
 OS not in Runtime
Once you have read out the information, the
respective drop-down list provides them to
you.
3. For the “Tags” tab:
In the dropdown list “Archive Tags” you select
the process value whose archived values you
wish to read out.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 60
3 Exporting archive data with Excel

Description Control element


4. For the “Tags” tab:
Specify the desired time interval in seconds,
via which the originally occurred values
(“native”) shall be summarized. If no interval
shall be used, (values remain “native”), then
enter “0”.

Note:
To reduce the amount of read out processed
values without losing too much information,
the time interval can be used.
The time interval enables to summarize all
process values which have occurred in a
certain time interval (e.g. all values in a
minute or hour). For this amount of values
evaluations can then be made (e.g. maximum
value, minimum value, total). This principle is
illustrated in Fehler! Unbekanntes
Schalterargument..
For the “Alarms” tab:
For filtering by different types (classes) of
messages, a total of six option boxes are
available to you that can be combined as
desired. When nothing is selected, filtering by
messages is disabled.
 Siemens AG 2018 All rights reserved

5. For the “Tags” tab:


Select whether an interpolation shall occur.

Note:
The interpolation requires a time interval
unequal zero.

Using the interpolation ensures that the time


distance between two received values always
remains the same. If no value has been
archived for a point in time, a respective
intermediate value is determined from the
direct previously and the direct successively
archived value.
Interpolation only occurs between two
respectively archived values within the time
range. Interpolation does not occur between
one value within a value outside the time
range.

Note You should use the filter options to limit the selection criteria to the largest extent
possible. By doing so, you reduce the number of relevant archive data and thus
the access time to the database and the subsequent processing time.
For messages, the number of returned data records is additionally restricted to
65000 by the SQL.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 61
3 Exporting archive data with Excel

Explanation of the time interval


The subsequent figure represents the course of a process value over several
hours. Using the vertical, dotted line, the curve is divided into the individual hours.

Figure 3-9

Assuming the archiving of the process values occurs every second, then the list of
 Siemens AG 2018 All rights reserved

up to 18000 values (for 5 hours) is fairly unclear. However, if specifying a time


interval of one hour, a total of maximal five values per column are given.
To still get a fair idea of the actual course of the curve it is possible to have
different information determined via the numbers of affected values. This is
illustrated in the Details view of the figure. It is possible to determine the extreme
values of the curve, the first and last value, the average and (not represented) the
total of all values which occurred in this interval and their number.
If an interval shows particularly noticeable behavior, it is possible to later on restrict
the time range accordingly, and reduce the time interval so that all information are
available to search for the cause in greater detail.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 62
3 Exporting archive data with Excel

3.4.4 Adapting the message structure

The adaptation of the message structure (selection of the message blocks) allows
you to individually display the received messages in the way that suits you best.
If the message structure is as desired, you can skip this point.

Figure 3-10
 Siemens AG 2018 All rights reserved

The table below describes how you can adapt the message structure to meet your
individual requirements.

Table 3-11
Description Control element
1. Click on the “Adapt Structure” button.
The “Data Selection” dialog box is opened.
2. In the left list (“Available Data”), select the
element you want to add to the selection and
click on the “->” button.
New elements of the right list (“Selected
Data”) are always inserted after the currently
selected element in this list.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 63
3 Exporting archive data with Excel

Description Control element


3. To remove this element from the selection,
select it in the right list and click on “<-”.
Removed elements are added in the lower
part of the left list.

4. Your settings are applied by clicking on “OK”.


To discard the changes, click on the “Exit”
button.

Note:
Adapting the data structure deletes all
currently listed messages. After confirming
the changes, no additional prompt is
displayed.
5. After confirming the changes, all column
 Siemens AG 2018 All rights reserved

headers and messages are deleted.


Subsequently, the new column headers are
entered and the column widths are adjusted.

Note:
If you have not selected a column for display,
the later read process is cancelled
prematurely. The status line displays the text
“No Data to be read”.

Note When starting the application, it automatically determines the settings last used
for the message structure from the entries in the “Column Headers” section of
the workspace.
When selecting the information for process values, ensure that any information
there, apart from the time stamp and the quality code, triggers its own read
process. The cause for this lies in the functionality of the respective SQL query.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 64
3 Exporting archive data with Excel

3.4.5 Reading Messages

Instruction
After you have made all settings, you can now read the desired messages from the
archive.

Table 3-12
Description Control element
1. Click on the “Read” button to read out the
messages from the archive that correspond to
the filter.

Watch out:
Using the “Read” button deletes all currently
listed messages. There is no additional
prompt.
Note:
Listing the messages can be aborted by
pressing the ESC key.
2. If necessary, back up the read data
separately.
 Siemens AG 2018 All rights reserved

Note After triggering the read command, the SQL query is first created and executed.
During this time, the application is not reactive since it has to wait for a response
of the SQL server. Depending on the number of requested messages, this can
last up to several minutes.
Subsequently, the individual messages are prepared (replacing the wildcards)
and listed. During this process, the update of the workspace is disabled to
increase message throughput, the status bar displays the progress of the
process.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 65
3 Exporting archive data with Excel

3.5 Error handling


The following section lists all error categories that can be assigned to the read
action:
 Connection error
– Action:
Connecting to the database
– Message:
“Error during Connect” + error description
– Possible causes:
Network problems (host not accessible); missing rights; missing installation
of the WinCC OLE DB Provider on the client

 Reading error
– Action:
Opening the database and reading out the messages
– Message:
“Error during Open” + error description
– Possible cause:
WinCC is not in Runtime on the server.
 Siemens AG 2018 All rights reserved

 Processing error
– Action:
Sorting and interpreting the message blocks, entering the messages
– Message:
“Error during Processing” + error description
– Possible cause:
The structure of the database and thus the structure of the returned
messages have changed.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 66
4 Exporting archive data with SQL Server

4 Exporting archive data with SQL Server


4.1 Configuration
 The export of archive values from SQL is parameterized directly in “SQL
Server Management Studio” using the “SQL Server Import/Export Wizard” and
can be triggered directly from the wizard following the parameterization.
 In addition, there is the option to save the created parameterization as an SSIS
package (.DTSX file) in the Windows file system and trigger the export later by
executing this file. The SQL query and therefore the scope of the data to be
exported are permanently stored in the SSIS package.
 When accessing the WinCC archive data, the WinCC OLE DB Provider must
be specified as the source, the data destination can, for example, be a newly
created, separate SQL database or an *.xls, *.xlsx, *.txt. or *.csv file.
 The following instructions describe how to parameterize the “SQL Server
Import/Export Wizard” for the export of archived measured values and alarms
to a *.csv file.
 The following instructions apply to SQL Server 2008 R2.

Table 4-1
No. Action
 Siemens AG 2018 All rights reserved

1.  Start the WinCC explorer. Open the WinCC project. Activate Runtime.
 Use the “Reverse-Osmosis” button to go to the “ReverseOsmosis.Pdl” screen.
 Select “STARTUP” to start the reverse osmosis plant. Wait until the plant has
reached the “Production” status.
 After an operating time of several minutes, press the “SHUTDOWN” button to
shut down the plant.
 Create a “TagsToCSV.csv” and “AlarmsToCSV.csv” file without content in the
directory of your choice.
2. In “Start > Programs > Microsoft SQL Server”, select “SQL Server Management
Studio”.
3.  Log on.
 In “Server type”, select “Database Engine”. In “Server name”, select
“<YourComputerName>\WINCC” and in “Authentication”, select “Windows
Authentication” (the current user will be used).
 Use the “Connect” button to connect to the SQL server.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 67
4 Exporting archive data with SQL Server

No. Action
4.  Right-click “Databases > CC_ExternalBrowsing” for runtime data and archive
data.
 Select “Tasks > Export Data” to start the SQL Server Import and Export
Wizard.
 Siemens AG 2018 All rights reserved

5. Click the “Next” button.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 68
4 Exporting archive data with SQL Server

No. Action
6. In “Data source”, select the “WinCC OLE DB Provider for Archives” and then select
the “Properties” button.

7.  Enter “.\WinCC” as the data source and the name of the WinCC Runtime
database as the catalog.
 Enter “CC_ExternalBrowsing” as WinCC Runtime database.
 Then select the “OK” and “Next” buttons to exit the dialogs.
 Siemens AG 2018 All rights reserved

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 69
4 Exporting archive data with SQL Server

No. Action
8.  In “Destination”, select “Flat File Destination” and the file “TagsToCSV.csv” (for
tag export).
 Check “Column names in the first data row” to write the column headers to the
first row of the *.csv file.
 Select the “Next” button to exit the dialog.
 Siemens AG 2018 All rights reserved

9.  Check “Write a query to specify the data to transfer” to specify the SQL query in
the next dialog.
 Use the “Next” button to continue the wizard.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 70
4 Exporting archive data with SQL Server

No. Action
10.  Now enter the desired SQL query. The query structure corresponds to the
description in chapter Fehler! Unbekanntes Schalterargument. and chapter
Fehler! Unbekanntes Schalterargument..
 In this example, the “QI900_ConductivityPearmeatIn” archive tag from the
process value archive is queried over a period of the last 30 minutes:

“TAG:R,‘ProcessValueArchive\QI900_ConductivityPermeatIn’,‘0000-00-00
00:30:00.000’, ‘0000-00-00 00:00:00.000’”

Notice
When entering the text string in American format, observe the format for
inverted comma and quotation marks (see figure).
 Then use the “Next” button to exit the dialog.
 Siemens AG 2018 All rights reserved

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 71
4 Exporting archive data with SQL Server

No. Action
11. In “Column delimiter”, select “Semicolon”.
 Siemens AG 2018 All rights reserved

12.  “Preview” allows you to check the result of the query.


 Select “OK” to close the dialog.
QI900 tag preview:

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 72
4 Exporting archive data with SQL Server

No. Action
13. Then check “Save SSIS Package” in the Windows file system without the protection
function and select “Next” to exit the dialog.
 Siemens AG 2018 All rights reserved

Note
A protection function is not required for the sample project. In productive mode, this
function should be set up as required by the application.
14. Enter the file name and location for the “SSIS package” and click on “Next”.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 73
4 Exporting archive data with SQL Server

No. Action
15. The following screen summarizes the configured parameters. Start the export with
the “Finish” button.
 Siemens AG 2018 All rights reserved

16.  As a final step, the result of the export is logged;


 “Reports” allows you to save the log as a text file.

17. Check the generated *.csv file.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 74
4 Exporting archive data with SQL Server

Note Instead of the tag name, you can also use the ValueID to access the archive.
This provides higher performance than the symbolic name (e.g., “TAG:R,4,‘0000-
00-00 00:30:00.000’, ‘0000-00-00 00:00:00.000’”).

A list of ValueIDs allows you to query multiple archive tags with one SQL
command. In the SQL command, this list is put in parentheses, the ValueIDs are
separated by semicolons.
(e.g. “TAG:R,(4,8,12),‘0000-00-00 00:30:00.000’, ‘0000-00-00 00:00:00.000’”).

For the ValueID of the archive tags, please refer to the “dbo.Archive” table. Use
the “Select Top 1000 Rows” context menu to open this “Tables>dbo.Archive”.

Note When entering the text string in American format, observe the format for inverted
comma and quotation marks.

Calling up the “DTSX packages”


To repeat the export, double-click the “SSIS Package” (DTSX file) to execute it and
then confirm the “Execute” button. A progress window displays the result.
 Siemens AG 2018 All rights reserved

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 75
5 Valuable Information

5 Valuable Information
5.1 Basics
5.1.1 SIMATIC WinCC/Connectivity Pack

The SIMATIC WinCC/Connectivity Pack is an option for WinCC. It allows licensed


access to WinCC online and archive data. The following standardized interfaces
are available for this purpose:
 OPC UA (Unified Architecture)
WinCC uses OPC UA to support the platform-independent successor
technology of OPC.
 OPC HDA (Historical Data Access)
Access to archived process values.
 OPC A&E (Alarms & Events)
Access to alarm events and archived alarms.
 OPC XML DA (web-based data exchange, cross-platform)
 Archive Connector
This tool allows the user to connect swapped out WinCC archive databases to
the SQL server or disconnect them from the server. An overview of the
individual database segments is created in the process. The Archive
 Siemens AG 2018 All rights reserved

Connector can monitor directories and automatically connect copied archives.


 WinCC OLE DB Provider
Provider for direct access to the process and alarm archives in the SQL Server
database on the WinCC RT machine and on a long-term archive server.
WinCC OLE DB Provider also allows the user to access the archives
connected to the “Archive Connector”.

5.1.2 WinCC OLE DB Provider

This document and the associated sample project specifically describe the benefits
and use of the WinCC OLE DB Provider. Aside from access to process value and
alarm archives, it provides additional analysis functions to determine, for example,
the minimum and maximum of archive tags.
WinCC V6.0 or higher segments the WinCC archive databases and stores them in
binary, encrypted format. The WinCC OLE DB Provider allows the user to
transparently provide this data in readable form. When accessing this data, the
user is not required to take decryption measures or consider segmentation.
Via the Provider the WinCC/Connectivity Pack Client has direct access to the
archive data. It is therefore irrelevant whether the data is compressed or
uncompressed.

5.1.3 Requirement for connecting to the WinCC database

In order to connect to a WinCC archive, the following requirements must be met.


 Part of a WinCC Runtime project
 Connected in SQL Manager via “Attach Database”
 Connected via the “Archive Connector”

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 76
5 Valuable Information

5.2 Alternative solutions


You have several options and add-ons for the exchange of data between SIMATIC
WinCC and applications (e.g., Office applications, MES and ERP systems). A
WinCC application is the basis of this data exchange.
A distinction must be made between access to online values (current values from
tag management) of SIMATIC WinCC and historical data (e.g., archived tags or
alarms).
The following table provides a brief overview of the different options provided by
SIMATIC WinCC with its associated options and add-ons. This table is not a
complete list.

Table 5-1
WinCC
2 Function for data
Product integrated Option Add-on
1 exchange

SIMATIC WinCC x - - Access via:


 OPC DA
SIMATIC - x - Access via:
WinCC/Connectivity  OPC UA
Pack
The successor of OPC with
all access options like DA,
 Siemens AG 2018 All rights reserved

HDA and A&E


 OPC XML DA
Online values of tags
 OPC HDA
Archived process values
 OPC A&E
Messages and alarms
 WinCC OLE DB Provider
Archived process
values/alarms
SIMATIC - x - Configuration tool and
WinCC/IndustrialData runtime environment for
Bridge data exchange between
different data sources
(providers) and data
destinations (consumers),
can also be used on a
stand-alone basis.

Note:
WinCC V7.4 or higher
supports *.txt, *.csv, *.html,
*.xml formats.
SIMATIC Information - - x Allows the user to save
Server reports in different formats,
including *.xls format.
PM-OPEN EXPORT - - x Export of online values and
archive data to text files
(*.ascii, *.csv, *.html, *.xml)

1
SIMATIC WinCC RT / RC – license sufficient
2
Add-ons are products from our Premium Add-On Partners

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 77
6 Annex

6 Annex
6.1 Service and support
Industry Online Support
Do you have any questions or need support?
Siemens Industry Online Support offers access to our entire service and support
know-how as well as to our services.
Siemens Industry Online Support is the central address for information on our
products, solutions and services.
Product information, manuals, downloads, FAQs and application examples – all
information is accessible with just a few mouse clicks at
https://support.industry.siemens.com

Technical Support
Siemens Industry's Technical Support offers quick and competent support
regarding all technical queries with numerous tailor-made offers
– from basic support right up to individual support contracts.
Please address your requests to the Technical Support via the web form:
www.siemens.de/industry/supportrequest
 Siemens AG 2018 All rights reserved

SITRAIN – Training for Industry


The training courses for our products and solutions are available worldwide and
support you with innovative learning methods.
Learn more about the trainings and courses on offer and their locations and dates:
www.siemens.com/sitrain

Note Basics can be acquired in the “SIMATIC WinCC, system course” in the SITRAIN
series.
 SIMATIC WinCC, Systemkurs (de)
 SIMATIC WinCC, System Course (en)
Topics for cross-system communication using the WinCC/Connectivity Pack are
discussed in the “SIMATIC WinCC advanced course”, among many other topics.
 SIMATIC WinCC, Aufbaukurs (de)
 SIMATIC WinCC, advanced course (en)

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 78
6 Annex

Service offer
Our service offer includes:
 Plant Data Services
 Spare Parts Services
 Repair Services
 On Site and Maintenance Services
 Retrofit & Modernization Services
 Service Programs and Agreements
Detailed information on our service offer is available in the Service Catalog:
https://support.industry.siemens.com/cs/sc

Industry Online Support app


Thanks to the "Siemens Industry Online Support" app, you will get optimum
support even when you are on the move. The app is available for Apple iOS,
Android and Windows Phone.
https://support.industry.siemens.com/cs/ww/en/sc/2067
 Siemens AG 2018 All rights reserved

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 79
6 Annex

6.2 Links and literature


Table 6-1
No. Topic
\1\ Siemens Industry Online Support
https://support.industry.siemens.com
\2\ Link to the entry page of the application example
https://support.industry.siemens.com/cs/ww/en/view/38132261
\3\ SIMATIC WinCC/Connectivity Pack V7.4 SP1 Manual
https://support.industry.siemens.com/cs/ww/en/view/109746336
\4\ Application example “Export of WinCC/CAS archive data with a separate
application”
https://support.industry.siemens.com/cs/ww/en/view/35840700
\5\ Application example “WinCC/IndustrialDataBridge: Writing data from SIMATIC
WinCC or from SIMATIC controllers in MS Office files”
https://support.industry.siemens.com/cs/ww/en/view/109483465

6.3 Change documentation


Table 6-2
 Siemens AG 2018 All rights reserved

Version Date Modifications


V1.0 08/2009 First version, WinCC 7.0 + ConnPack
V2.0 02/2016 WinCC 7.3 + ConnPack, new application example layout +
revised scripts. Changes in the documentation.
V3.0 03/2018 WinCC 7.4 SP1 + ConnPack, revised scripts + export of
archive data to Excel. Changes in the documentation.

Archived data export with the OLE DB Provider


Entry ID: 38132261, V3.0, 03/2018 80