Script for creating report

A forum devoted to the discussion of all topics having to do with scripting and other advanced programming using iX Developer.
Post Reply
vilius
Posts: 10
Joined: Mon Feb 06, 2012 8:36 am

Script for creating report

Post by vilius »

Hello,

I need to create a printable report from some historical data. For example, I need a report which would show working hours for different periods of time, something like this:

Variable |Per hour | Per month | Per year|

Working hours | 20 mins | 20 hrs | 254 hrs
Average current | 2A | 2,5 A | 1,8 A
Custom text |tag value |tag value |tag value
I hope you got the idea.
I didn't find this kind of function using graphic interface but maybe there is any way I could this via scripting?

Thank you!

P.S. My "table" didn't work out but I hope it's clear enough!

User avatar
Ron L.
Posts: 214
Joined: Fri Jul 15, 2011 3:21 pm

Re: Script for creating report

Post by Ron L. »

Do you need to have this report saved as a text file, e-mailed or sent to a printer?
Best Regards,

Beijer Electronics, Inc.
Ron Lloyd | Applications Engineer

vilius
Posts: 10
Joined: Mon Feb 06, 2012 8:36 am

Re: Script for creating report

Post by vilius »

Sorry for not being specific enough. Most important feature is to be able to save it as a text or .xls file, viewing the report in SCADA and sending it to printer is not so important.
Thank you!

User avatar
Ron L.
Posts: 214
Joined: Fri Jul 15, 2011 3:21 pm

Re: Script for creating report

Post by Ron L. »

Yes, this is possible with built in functionality. You can use the "DataLogger" in iX Developer to log 1 or more rows of Tag data. The data can then be exported in .CSV format which is compatible with Excel. You can export the file to a USB stick or a folder using the action "Database Export". If saved to a folder, the file can be retrieved via FTP.

If you want to create a more customized file this can be accomplished with C# scripting.
Best Regards,

Beijer Electronics, Inc.
Ron Lloyd | Applications Engineer

vilius
Posts: 10
Joined: Mon Feb 06, 2012 8:36 am

Re: Script for creating report

Post by vilius »

Ron, thank you for your reply!
However, .csv file export is not exactly what I need. I need kind of a simple table with data. Basically, first column should be custom text which I don't need to change too often (it could be done via scripting) or connected to a string tag. Second column should be a number taken from any tag, so a tag value. I don't really need exporting trends, because I'm going to need just single value of a tag and I need something better looking and more user-friendly (better readability) than .csv file. Would you happen to have any script which I could use at least as a reference?
Thank you!
This is how I imagine the table should look like.
This is how I imagine the table should look like.
table.JPG (6.96 KiB) Viewed 11539 times

Skylar
Posts: 42
Joined: Wed Jan 04, 2012 11:17 am

Re: Script for creating report

Post by Skylar »

Hi vilius,

Here is a sample script I created that demonstrates how to export a database table into a format similar to what you are asking for. The script generates an HTML file, and it wouldn't be very much work to format it exactly how you'd like it to look.

Let me know how it works... I hope that helps! :)
Attachments
Script_Database_Export_HTML.zip
(288.77 KiB) Downloaded 1079 times
Best Regards,

Beijer Electronics, Inc.
Skylar Walker | Applications Engineer

vilius
Posts: 10
Joined: Mon Feb 06, 2012 8:36 am

Re: Script for creating report

Post by vilius »

Thanks a lot!
I have downloaded it and have a look some time soon.

Regards,
Vilius

Post Reply