Send multiple point value in alarm text
-
@phildunlap Hi Phil, I have to reopen this discussion, today when I played around with the email feature, I was trying to customize the email and I've noticed that the time when the alarm was triggered is not the same with the time for the values, and this make sense because I record that values in the database every minute.
So I have a question, can I print there the instant value, not a recorded value from my data base? Because when the alarm is triggered that point can have another value that the one that is last recorded in my database.
-
I think what you're looking for could be found in the Mango/ftl/ files. The eventData.ftl files shows you can do
${evt.prettyActiveTimestamp}
evt
is a https://github.com/infiniteautomation/ma-core-public/blob/main/Core/src/com/serotonin/m2m2/rt/event/EventInstance.java so you can use those getter functions in the FTL, as prettyActiveTimestamp does. -
@phildunlap Thank's, if I put this line I get the same time for all the points.
${evt.prettyActiveTimestamp}
But my question is the value in real time or is last value from my database?
-
Are you saying you put that in the loop?
But my question is the value in real time or is last value from my database?
I don't understand what you're asking.
-
@phildunlap Ok, let say that my temperature point is recorded in my database every 3 minutes, but my point is updated form PLC at every 5 seconds, (the record at every 3 minutes is made by an average off all readings between those 3 minutes, correct?).
If my alarm point occurs somewhere between those 3 minutes intervals which value is displayed for T0? Instant value or the last value recorded?
I came with this problem when I saw that the timestamp for the alarm trigger point and T0 are different.
I hope I was clear enough :)
-
The answer has some to do with the configuration of the event detector. For instance, if you have a high limit detector and it does not have a duration, then the timestamp of the event should be the time that the polling got a value above the limit. If it did have a duration, then it should be the time that the polling was above the limit, provided it stayed above the reset limit for the duration, plus the duration. This is why the event text would include that the duration was exceeded.
Interval logging is not the driver of the event detectors for the point they are on. If you wish to have event detectors on the interval logged average, you can use a meta point with its context event set to
Logged
. -
@phildunlap Hi Phil, I made some test with some points. I have 3 points, one is the point which trigger the alarm and the other two points are a value for temperature and pressure. These two points are logged into my data base every 3 minutes. When the alarm is triggered it sends me in the email the last value that was recorded into my data base which is not the real time value because after the alarm the temperature and the pressure changed but the new values are not recorded into the data base yet.
I think this line, line 7, get the last recorded value, it is a way to get instant value instead?
Thank you!
-
I presume you still want 10 values, and not 1 as in the image?
var rawValues = temperature.last(9); //second argument is cache control. Default is false rawValues.addAll(temperature.last(1, true)); //if omitted, as of 3.5
-
@phildunlap Yes, now works fine. And I found that if I want only one value, and that one to be the real time value I have to write like this:
var rawValues = pressure.last(1, true);
Thank you! Have a great day!
-
I used that function because it will give a java.util.List which we could addAll to the other list acquired the same way. You could also use the lastValue function, as described in the JavaScript help, or simply use the .value and .time from the point (which actually wouldn't work quite right here because we need to go through the text renderer, and a .value is a primitive data type usually instead of a DataValue object.