Hello,
I use WinCC OA 3.11-SP1 and I read and archive data via Modbus- and S7-drivers (several data points).
Now I would like to export this data in csv-files or similar for further processing in Excel. However, my license does not support the Excel-Report function and I do not have the ETool Module installed.
Is it still possible to export the data? If yes, I would be very grateful for any tips concerning the export-procedure.
By the way: The data is archived in "ProjectFolder\\db\\wincc_oa\\VA_000x" and has filenames like "AR_0000_2013.11.10.-01.00.30". Unfortunately, I don't know how to process these files.
Thanks in advance!
CSV export
- leoknipp
- Posts:2928
- Joined: Tue Aug 24, 2010 7:28 pm
Re: CSV export
Hello,
if you want to save data in csv-files you have to write the export function on your own.l
To read historical data you can use the functions dpGetPeriod(), dpGetAsynch() or dpQuery with the TIMERANGE keyword.
Writing the information into files is possible with the file functions of WinCC OA, .
For details please have a look at the online help:
CONTROL --> Types of functions --> File functions
CONTROL --> Types of functions --> Query functions
The VA-files cannot be read with external programs.
Maybe you can use the OLEDB-provider to access data which is stored in the VA-files, see online help:
System management --> Database --> OLE DB provider
Please note that the OLE DB provider cannot be used in a 64bit system. You have to make a 32bit installation of WinCC OA on a client system, because it is recommended that the server is using a 64 bit installation.
Best Regards
Leopold Knipp
Senior Support Specialist
if you want to save data in csv-files you have to write the export function on your own.l
To read historical data you can use the functions dpGetPeriod(), dpGetAsynch() or dpQuery with the TIMERANGE keyword.
Writing the information into files is possible with the file functions of WinCC OA, .
For details please have a look at the online help:
CONTROL --> Types of functions --> File functions
CONTROL --> Types of functions --> Query functions
The VA-files cannot be read with external programs.
Maybe you can use the OLEDB-provider to access data which is stored in the VA-files, see online help:
System management --> Database --> OLE DB provider
Please note that the OLE DB provider cannot be used in a 64bit system. You have to make a 32bit installation of WinCC OA on a client system, because it is recommended that the server is using a 64 bit installation.
Best Regards
Leopold Knipp
Senior Support Specialist
- aorange
- Posts:147
- Joined: Thu Nov 04, 2010 10:07 am
Re: CSV export
Try this;
Code: Select all
int CreateCsvFile(string strExportPath, string strCsvExportFileName, dyn_anytype daSomeData)
{
// Create a new file to write these values to
file f;
int err;
f=fopen(strExportPath + "/" + strCsvExportFileName, "w+"); // open for reading
err=ferror(f); // export error
if(err == 0)
{
fprintf(f, "%s", "," + atSomeData[1]);
fprintf(f, "%s", "," + "\\n"); //EOL
fprintf(f, "%s", "," + atSomeData[2]);
fprintf(f, "%s", "," + "\\n"); //EOL
.
.
.
.
fclose(f);
return 0;
}
else
{
DebugN("Error no. " + err);
return -1;
}
}
- leoknipp
- Posts:2928
- Joined: Tue Aug 24, 2010 7:28 pm
Re: CSV export
Hello,
the given example will not really write a csv-file.
It will only write lines with a leading "," and "ending" at every line.
Also the example does not detect automatically how long the array of values is which shall be written to the csv-file. You have to use a for-loop or at least a while-condition.
Best Regards
Leopold Knipp
Senior Support Specialist
the given example will not really write a csv-file.
It will only write lines with a leading "," and "ending" at every line.
Also the example does not detect automatically how long the array of values is which shall be written to the csv-file. You have to use a for-loop or at least a while-condition.
Best Regards
Leopold Knipp
Senior Support Specialist
- aorange
- Posts:147
- Joined: Thu Nov 04, 2010 10:07 am
Re: CSV export
Okay I simplified the example a bit too much but the idea works... or at least it worked for me in a live project
Code: Select all
int CreateCsvFile(string strExportPath, string strCsvExportFileName, dyn_anytype daSomeData)
{
// Create a new file to write these values to
file f;
int err;
f=fopen(strExportPath + "/" + strCsvExportFileName, "w+"); // open for reading
err=ferror(f); // export error
if(err == 0)
{
for(int i = 1; i