cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Kepware: Advanced templates in Iot-gateway

KR_9956386
3-Newcomer

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. 

ACCEPTED SOLUTION

Accepted Solutions
aservetas
15-Moonstone
(To:KR_9956386)

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

View solution in original post

4 REPLIES 4

 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 

This video will provide an overview of the IoT Gateway template, as well as some new features that have been added. Additionally, this video will also walkthrough the use cases and how to configure the new template variables

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. 

aservetas
15-Moonstone
(To:KR_9956386)

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

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


Announcements


Top Tags