Wincc Flex(reading a CSV file via VB)

NoName

Member
Join Date
Sep 2003
Location
Domžale
Posts
273
Hello all...

I'm trying to write a code that would read the csv file that WinCC flexible runtime makes when it's loging some variables. My knowledge of VB is very basic, so i know how to sort data around an so on...

I have to write a code so that it will read the logged data in the csv file, and make daily reports, monthly reports and yearly reports. I'm haveing problems reading the data that is stored in the csv file. When I get that working, I'll be able to do the rest.

Can anyone point me in the right direction, if there are any examples on how to do this I would be very gratefull.

Regards Aleš
 
I think that you are doing the report generation in the wrong place - I wouldn't use the scripting capabilites of Flex - I would do what I have to do in excel or MS Access .
 
Have you looked at the reports in WinCC Flex? I'm not sure they will work with logged data but it could save you some work. You may also look at logging the data into Excel or Access directly. I have not done this because I did not want to install them on my HMI computer but I have seen the option to log to external data source.

I posted some code that reads a csv file and puts it into an HTML table. If the data is saved into HTML table then Excel will open it up with no problem.

http://www.plctalk.net/qanda/showthread.php?t=19379
 
NoName,

The world of Visual Basic is much larger than our world of automation. You can find what you are looking for at any VB site on the net. The CSV log file from WinCC Flexible contains the T&D, Tag Name, Quality, and Value. You can use the data control within VB or many other ways to parse this data in your VB application to generate the reports your looking for.
 
This is parts of a script that i used in Protool Pro a couple of years back for a simular task maybe it helps. I quickly translated the comments from Swedish please ask again if you wonder anything

Dim aLines, fsoReadSymbol

Const ForReading = 1, ForWriting = 2, ForAppending = 8

Set WshShell = CreateObject("WScript.Shell")

Set fsoReadSymbol = CreateObject("Scripting.FileSystemObject")

'*********************************************************************************
'Define path to file here
Dim path : path = "c:\test.csv"
'*********************************************************************************

'Opens file for reading
Set readSdf = fsoReadSymbol.OpenTextFile(path, ForReading, false)

'Loop every line in file
Do While Not (readSdf.AtEndOfStream)

'Reads one line from the file
strSymbol = readSdf.ReadLine

'Split line at every , sign
aLines = Split(strSymbol, ",")

'aLines(0)

'Loop every line
Loop

'Close access to file
readSdf.Close
 
Also check out this link:
http://support.automation.siemens.com/WW/view/en/23235548

It is a STEP7 Project with a panel and a PC runtime. It has the framework to both write to and read from CSV files.
It is made in Protool, but you can import it into Flexible.

Notice that scripts on Windows CE and "normal" Windows are not the same, so pick the right target when you start !
 

Similar Topics

I'm trying to read barcodes using a symbol scanner that's attached to my mp 377 (win ce) panel via usb. I have the scanner set to emulate keyboard...
Replies
1
Views
2,137
I'm continuing my Siemens education. I need some help with compatibility details. My customer has a machine that was made by a company no longer...
Replies
6
Views
4,023
Hello all. I mainly work with Siemens PLC's and panels for our machines. But now I am faced with a pilot project that has to be as price friendly...
Replies
15
Views
8,034
Hi Folks. I have an older application that weighs pallets and prints labels for them. We used to capture the time/date of weighing, but we...
Replies
2
Views
1,611
Hi, I have WinCC Felxible 2008 SP5 installed on my Windows 10. I want to program Simatic panel TP177B using USB transfer cable. But i can't...
Replies
8
Views
2,104
Back
Top Bottom