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

Binding KEPServer Tags to Thing Properties

praveen_aggrawa
3-Visitor

Binding KEPServer Tags to Thing Properties

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

 

1 ACCEPTED SOLUTION

Accepted Solutions

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.

 

View solution in original post

2 REPLIES 2

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.

 

slangley
23-Emerald II
(To:amittal-3)

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

Announcements