Skip to main content
1-Visitor
January 27, 2022
Solved

Kepware: Advanced templates in Iot-gateway

  • January 27, 2022
  • 3 replies
  • 3799 views

Hi,

I am using Iot-gateway in Kepware, and I want to only send messages if they have quality set to true. I tried to use Advanced templates, but I could not find any guide anywhere on how to use the directives there. I tried this, but got an error. 

{
"timestamp": |SERVERTIMESTAMP|,
"machine_ID": "m_id1",
"values": [
|#each VALUES|
{"id": "|TAG|", "v": |VALUE|, "q": |QUALITY|, "t": |TIMESTAMP| } |#unless @last|,|/unless| |#unless |QUALITY|="false"||/unless|
|/each|
]
}

KR_9956386_1-1643312789760.png

 

Please help. 

Best answer by aservetas

The closest setting we have is “ignore quality changes”. That should allow you to receive only value changes. What you specifically requested is not supported.

 

Best regards,

Andy Servetas
Principal Technical Support Engineer | Kepware Technologies

3 replies

24-Ruby III
January 28, 2022

 Hi,

 

You can read about "Advanced Template" in the attached guide.

 

P.S. "Getting Started with the IoT Gateway Advanced Template": https://www.youtube.com/watch?v=s8F1rr74_vs 

1-Visitor
January 28, 2022

Hi, 

I saw the video before and read the document, but nothing there. I need a more complete guide on Advanced Templates to solve my problem. 

aservetas15-MoonstoneAnswer
15-Moonstone
February 4, 2022

The closest setting we have is “ignore quality changes”. That should allow you to receive only value changes. What you specifically requested is not supported.

 

Best regards,

Andy Servetas
Principal Technical Support Engineer | Kepware Technologies

1-Visitor
June 1, 2022

Hi,

I tried some way to use them if-else. Please try if possible with the help of unless. 
My problem statement : 

 

I want to display the timestamp and description only once. so I developed this template and it is working as per expectation. 



Please check if you can use something like this. 
{
"timestamp": |SERVERTIMESTAMP|,
"values":
[
{|#each VALUES||#unless @first||else||LINEFEED|"t": |TIMESTAMP|,|LINEFEED|"id":"|DESCRIPTION|",|LINEFEED||/unless|"|TAG|": |VALUE|,|LINEFEED||/each|
}
]
}