Skip to main content
1-Visitor
September 17, 2018
Solved

Binding KEPServer Tags to Thing Properties

  • September 17, 2018
  • 1 reply
  • 2545 views

Is there a way to automate below using JavaScript function?

  • By selecting tags from the Industrial Connection Thing -> Discover and using the "Bind to New Entity" button

 

Related to previous topic

 

Best answer by amittal-3

Hello,

There is a function/service available to set remote binding "SetRemotePropertyBinding", have you already tried to use that service?

Important parameter for this service is 'aspects', you might have to set that properly as it requires the JSON value. Just for reference I am providing the snippet of a service (custom, that you might like to have) which sets the 'aspects' param of "SetRemotePropertyBinding" (rest all the fields are quite understandable)

 

//service snippet for setting remote binding aspects

var myInfoTable= DataShapes["/*your datashape that holds aspect fields*/"].CreateValues();
myInfoTable.RemoveAllRows();

myInfoTable.AddRow(
 {
 industrialDataType: "Float",
 tagAddress: /*your kepware complete tag address*/, /*you can see that in KEP client*/
 scanRate: 1000,
 tagType: "Static",
 dataShape: ""
 });

var result = myInfoTable.ToJSON().rows[0];

//Output of the service is STRING
var params = {
 propertyName: 'your_property_name' /* STRING */,
 pushThreshold: 0 /* NUMBER */,
 aspects: 'use above reference to create aspects field' /* JSON */,
 foldType: undefined /* STRING */,
 sourcePropertyName: undefined /* STRING */,
 timeout: 0 /* INTEGER */,
 pushType: "VALUE" /* STRING */,
 cacheTime: undefined /* INTEGER */
 };
 me.SetRemotePropertyBinding(params);

The important thing is you should already be having propert(y/ies); (as you have to specify the property_name as param in 'SetRemotePropertyBinding') in your remote thing to automate the binding process. If required you might want to create properties in the remote thing dynamically.

Hope it helps.

 

1 reply

amittal-31-VisitorAnswer
1-Visitor
September 24, 2018

Hello,

There is a function/service available to set remote binding "SetRemotePropertyBinding", have you already tried to use that service?

Important parameter for this service is 'aspects', you might have to set that properly as it requires the JSON value. Just for reference I am providing the snippet of a service (custom, that you might like to have) which sets the 'aspects' param of "SetRemotePropertyBinding" (rest all the fields are quite understandable)

 

//service snippet for setting remote binding aspects

var myInfoTable= DataShapes["/*your datashape that holds aspect fields*/"].CreateValues();
myInfoTable.RemoveAllRows();

myInfoTable.AddRow(
 {
 industrialDataType: "Float",
 tagAddress: /*your kepware complete tag address*/, /*you can see that in KEP client*/
 scanRate: 1000,
 tagType: "Static",
 dataShape: ""
 });

var result = myInfoTable.ToJSON().rows[0];

//Output of the service is STRING
var params = {
 propertyName: 'your_property_name' /* STRING */,
 pushThreshold: 0 /* NUMBER */,
 aspects: 'use above reference to create aspects field' /* JSON */,
 foldType: undefined /* STRING */,
 sourcePropertyName: undefined /* STRING */,
 timeout: 0 /* INTEGER */,
 pushType: "VALUE" /* STRING */,
 cacheTime: undefined /* INTEGER */
 };
 me.SetRemotePropertyBinding(params);

The important thing is you should already be having propert(y/ies); (as you have to specify the property_name as param in 'SetRemotePropertyBinding') in your remote thing to automate the binding process. If required you might want to create properties in the remote thing dynamically.

Hope it helps.

 

Community Manager
November 27, 2018

Hi @praveen_aggrawa.

 

If the response from @amittal-3 answered your question, please mark it as the Accepted Solution for the benefit of others who may have the same question.

 

Regards.

 

--Sharon