Skip to main content
Jan 27, 2022 7:51 PM UTC
Solved

Kepware: Advanced templates in Iot-gateway

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. 

aservetasAnswer
Feb 4, 2022 3:50 PM UTC

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

4 replies

Jan 28, 2022 9:21 AM UTC

 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 

Jan 28, 2022 12:58 PM UTC

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. 

aservetasAnswer
Feb 4, 2022 3:50 PM UTC

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

Jun 1, 2022 11:09 AM UTC

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|
}
]
}