Ewon TechForum
Providing technical solutions to technical requests


DataMailBox CSV Generator
simon Offline
eWON Support
#1
Hi,

I have developed a DataMailbox driver that generates CSV files.
This program is actually based on the "MyLittleHistorian" example provided with DataMailBox SDK.

For users : just copy the directory "ReadyToUse" in the attached zip.
For developers : All the source code is in the zip.

How to configure it ?
Copy the directory "ReadyToUse" in c:\
Create a file named "config.ini" and type your parameters. There is an example in the directory.
Here is the list of parameters available :
  • DevId:Type the DevID
  • AccountName:Type your account
  • Username: Type the password of your Talk2M account
  • Password: Type the password of your Talk2M account
  • DeleteData: Delete the data of the datamailbox after collecting it (yes/no). If multiple instances are collecting data on the same account, type "no"
  • CSVFileName: Name of the CSV file generated. This field can accept some dynamic keywords : %YEAR%, %MONTH%, %DAY%, %HOUR%, %EWONNAME%, %TAGNAME%. Ex : If you use %TAGNAME% in your Filename, then a different CSV file will be created for each Tag.
  • CSVLineFormat: Format of the line in the CSV. Here are the keywords available : %EWONNAME%,%TAGNAME%,%TAGDATE%,%TAGVALUE% and %QUALITY%
  • DateTimeFormat:Format of the time and date according to https://msdn.microsoft.com/en-us/library....110).aspx 
  • CSVOutputDir: Directory where the CSV files wll be stored.  The directories are automatically created. This field can accept some dynamic keywords : %YEAR%, %MONTH%, %DAY%, %HOUR%, %EWONNAME%, %TAGNAME%. Ex : If you use %EWONNAME% in your OutPutDir, then a different directory will be created for each eWON.
  • ForceRetrieveAll: Flag to force to program to retrieve all the data of the DataMailbox (TransactionID=0).
Example of config.ini :

Code:
DevId:61e9ac64-6ade-414e-ad4e-a79dde788010
AccountName:flexthink
Username:guest
Password:guest
DeleteData:no
CSVOutputDir:D:\Users\sdr\mydata\%YEAR%_%MONTH%_%DAY%\%EWONNAME%\
CSVFilename:%YEAR%_%MONTH%_%DAY%_%HOUR%_%EWONNAME%_%TAGNAME%.csv
CSVLineFormat:%EWONNAME%;%TAGNAME%;%TAGDATE%;%TAGVALUE%;%QUALITY%
DateTimeFormat:MM/dd/yy H:mm:ss zzz
ForceRetrieveAll

The config.ini file is deleted at the first start.  The settings are then saved in a specific application file only accessible by the SYSTEM (Admin) user.


How to launch it ?
You can launch it manually by clicking the exe file.
Or
If you want to run it automatically, just right-click the file "installMyCSVHistorianScheduledTask.bat" and select "Run as Administrator".
This will add a new Scheduled Task in Windows.  This task will launch the program automatically even if you are not logged and will run every 5 min (Can be configured by editing the Scheduled Task).

Troubleshoot
If you don't get your data, you have a file "Log.txt" which contains the logs of the last execution.


Attached Files
.zip   MyCSVHistorian.zip (Size: 364,67 KB / Downloads: 112)
Reply

Lonny Offline
Junior Member
#2
I need to change the config.ini but Where did it go?
Reply

simon Offline
eWON Support
#3
It removes it and create a xml config file in your user directory (If I remember well in %APPDATA%/ProgramName/filename). That's a standard .NET command
Reply

Lonny Offline
Junior Member
#4
The Generator is working perfectly but is there a way to add a header row to the file?
Reply



Possibly Related Threads…
18-12-2019, 10:42 AM
Last Post: simon
19-11-2019, 01:54 PM
Last Post: simon
  DataMailBox to Azure Started by simon
7 Replies - 7.141 Views
16-10-2019, 11:04 AM
Last Post: Nick_ARCsom
31-01-2019, 06:13 PM
Last Post: Franziska
02-11-2018, 04:28 PM
Last Post: Adithyan Peringode
24-05-2018, 10:53 PM
Last Post: wesmoore
  DataMailBox access Started by mibu
1 Replies - 1.768 Views
11-02-2018, 05:19 PM
Last Post: simon
04-10-2017, 08:34 AM
Last Post: iOne



Users browsing this thread:
1 Guest(s)



Theme © Ewon 2019 - Forum software by © MyBB - Cookie policy