I have 3 imput field, every day i must count sum of this field
Everyday i must reset value to 0, in 23:00 it must hapend.
In need of the month we need to sum of every day, and in end of year i need to calc sum of 12 month.
This 3 value must be writed into the tags. All miust be writed by skripting.
Thans for the response
Why?
Honestly the majority of this task is better handled in the device. Do you not have access to the program?
Even then why not use tag history or some other type of history, or is that really what you're trying to produce?
Do you have three inputs or one? What are the data types of the inputs?
Could u show how i can do it by another method
I have 3 imput, they all int, I also need to put this data to database(MySQL)
If I use tag history, how I can do this?
Maybe this post will give you some guidance,
Thank you!
Let's take a step back.
What are you trying to do ? And I don't mean "summing fields and storing the data", I mean the end goal - what is this supposed to achieve ?
Then, some more details are required:
What exactly do you need to sum ? The three fields together ? Each field with itself when a new value is entered ?
When do you need to sum them ? At 23:00 everyday ?
The whole thing raises a lot of questions. Try to be as specific as possible.
I have 3 data inputs, I need to write a code that will accept these 3 inputs and calculate their sum, every day at 23:00 I need to update the input value to 0 so that I can enter data again.
Then I need to find the sum of all 3 inputs for all days of the month at the end of the month. At the end of the year, you need to take the sum of all months.
Sorry
I am not a native English speaker and a beginner in ignition
Read the manual. You just need Gateway Event Scripts.
Create several tags for your inputs and sums.
https://docs.inductiveautomation.com/display/DOC81/Gateway+Event+Scripts
No problem here. We just have to make sure we understand what you're asking, which is why I'm asking questions.
One more clarification:
Should the sum be calculated at the same time the fields are reset ?
I'd specifically want to know if it should be calculated only once a day, with the current values, or if the calculation happens multiple times through the day.
Also, I still suggest you try to explain the goal of this, because maybe there are better ways to do it, that are hidden by the solution you're already trying to implement.
Yeah, sum should calculated at the same time after fields sre reset.
It should calculated once a day.
This is automation for the company, data will be recorded here on how much certain workers did per day.
Thank you
How are the values entered in those fields ? Is it done manually ?
I'd use 3 tags bidirectionally bound to the input fields, then a timer script that would fetch those 3 values, sum them up, then store that in a database with the date.
Every month, you can query that database to sum up the last month's values, and every year sum up the last year's values.
We use 3 LED Display which have popup window. So we take data from this popup window.
Can u show some exaples how i can do this.