Get Last Message DateTime, Received by Production Component, with ObjectScript code.
Hello, good morning, thank you so much for reading this question. ☺️🙂👍
We are developing a code to get information about our Production's items: services, processes and operations.
We know we can get various configurations of a given item: Category, Port, Enabled...
But we wonder how we could get the date time of the last mesage (most recent) received in an item.
To give a code snippet a small section of the code we have developed (and tested), it looks like:
[...]
For i=1:1:tProduction.Items.Count() {
#dim item as Ens.Config.Item
set item = tProduction.Items.GetAt(i)
set Componente = ##class(EsquemasDatos.Monitorizacion.Componente).%New()
set Componente.Nombre = item.Name
set tipo = item.BusinessType()
setx = 0if (tipo = "1") {
set Componente.Tipo = "Servicio"setx = item.GetSetting("Port",.port); 06/02/2024 To get the port of DICOM Servicesif (x '= 1){
setx = item.GetSetting("IPPort",.port)
}
set Componente.Comentario = item.Comment
if (tipo = "2") {
[...]
}
[...]
}
[...]
We would like to get the date and / or date-time of the most recent message sent to that given item, like the one we see on the Production's menu under "Messages" tab:
.png)
However, how could it be doable?
We have looked for similar documentation, threads / questions, but we are unnable to find useful information.
We have looked for:
https://docs.intersystems.com/irisforhealthlatest/csp/docbook/DocBook.U…
https://community.intersystems.com/post/custom-monitoring-page-iris-int…
https://community.intersystems.com/post/sql-calculate-time-last-message
However, we still having the exact same doubt.
Please, could you help us?
Thank you so much! 🙏☺️🙂👍🙏
Comments
Why don't you execute a SQL query over the message table?
You can achieve this by querying Ens.MessageHeader (see https://docs.intersystems.com/irislatest/csp/documatic/%25CSP.Documatic…).
something along the lines of
select top 1 TimeProcessed From Ens.MessageHeader where TargetConfigName='MyConfigItem'orderby TimeProcessed desc