Welcome, Guest
Username: Password: Remember me

TOPIC: How to display consumption for a period.

How to display consumption for a period. 2 months 4 weeks ago #2666

  • Richter
  • Richter's Avatar
  • Offline
  • Junior Member
  • Posts: 25
  • Karma: 0
Hello

I am solving one problem.
I have a tag where the electricity meter counter is displayed OK.
I have a history database where the tag is saved regularly. OK
The history table shows this data, but it shows the value, not the consumption for the period.
I would need advice on how to make a screen where there would be a table showing consumption per day - 31 lines. always only for the current month.
Another table would display the consumption for months - 12 rows. always only the current year.
Another table would show the consumption per year

how to do this?

Pavel
The administrator has disabled public write access.

How to display consumption for a period. 2 months 3 weeks ago #2667

  • fatkhrus
  • fatkhrus's Avatar
  • Offline
  • Administrator
  • Posts: 814
  • Thank you received: 121
  • Karma: -108
Hello Pavel,

It's hard to explain. So I've prepared video explanation:
ST script database library description: teslascada.com/HTML/database-library.html
Description of database table object: teslascada.com/HTML/database-table.html
Video tutorial about database: teslascada.com/videotutorials/teslascada...-st-script-functions
Example project from the video I've attached.

File Attachment:

File Name: consumption.tsp2.zip
File Size:3 KB


Best regards,
Ruslan
The administrator has disabled public write access.

How to display consumption for a period. 2 months 3 weeks ago #2668

  • Richter
  • Richter's Avatar
  • Offline
  • Junior Member
  • Posts: 25
  • Karma: 0
Hello,

thank you very much.
I only use graphical programming because it's logical what it does and I'm completely stupid at text programming. I do not understand at all the words, special characters, brackets ... what does it do. I change something and it stops working. It's driving me crazy. :-) I tried it. But I guess the part of my brain that can do this hasn't grown :-)

I'll try again but I'm worried about my mental health. :-)

In your example, consumption per minute is shown. I would need line 1 to be, for example, December 1. and its value will increase during the day.
At 24:00, the second line will start growing on December 2nd. and its value will increase again throughout the day.

In the month table it would be the same only by months. The 1st row will grow all month. On the 1st of the next month, the second row will begin to grow.

in excel it is very simple.
A large table where each day has its own cell. 365 cells for a year 3650 cells for 10 years ...
Once a day, I always write down the value of the counter at the same time, and the formula calculates my daily consumption, adds this consumption to the monthly and annual consumption.
The second small table shows only the resulting data. Simple and clear.
But it's manual, so I thought the computer would do such a simple operation itself.

Thank you. I will open your file and keep trying.
The administrator has disabled public write access.

How to display consumption for a period. 2 months 3 weeks ago #2669

  • Richter
  • Richter's Avatar
  • Offline
  • Junior Member
  • Posts: 25
  • Karma: 0
Hello,

I tried and got partial success. The strange thing is that the calculation table works for me when I start the project in the IDE, but the diff calculation table does not work in the runtime.
Doesn't he know what it is?

Pavel
The administrator has disabled public write access.

How to display consumption for a period. 2 months 3 weeks ago #2670

  • Richter
  • Richter's Avatar
  • Offline
  • Junior Member
  • Posts: 25
  • Karma: 0
I click on calculate but nothing happens...
Attachments:
The administrator has disabled public write access.

How to display consumption for a period. 2 months 3 weeks ago #2671

  • fatkhrus
  • fatkhrus's Avatar
  • Offline
  • Administrator
  • Posts: 814
  • Thank you received: 121
  • Karma: -108
Yes, sorry for that. It's our mistake. Unfortunately in Runtime version we've forgotten to change SQLlite library into the new version. We'll do it in the next version. Now you can do it manually. From the libs folder where installed IDE copy sqlite-jdbc-3.34.0.jar file into the folder where installed Runtime in the libs folder. And remove old sqlite-jdbc-3.8.10.1.jar.

Best regards,
Ruslan
The administrator has disabled public write access.
Go to top