Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Is there a way to automate below using JavaScript function?
Related to previous topic
Solved! Go to Solution.
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.
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.
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