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

How can I retrieve active bound properties on a Thing on ver9.1

TMnemo_11
9-Granite

How can I retrieve active bound properties on a Thing on ver9.1

TM_10841814_0-1704447349778.png

Is it possible to get a list of all bound properties and their source and VTQ on a Thing by executing a service? Ideally I would like to monitor bad endpoints and create some notification to help track and fix any problems. 

TM_10841814_0-1704447604910.png

I have tried the getBound Items function with no success, even though I have quite a number of properties bound on my thing.

1 REPLY 1

Hi @TMnemo_11 ,

 

If you want to get the remote bounded property values with quality,time & value means, below given code will helps you to acheive it. Kindly try with it, If any queries please let me know.

var params = {
	infoTableName: "InfoTable",
	dataShapeName: "PropertyDefinition"
};

// CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(PropertyDefinition)
var FinalData = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);

// result: INFOTABLE dataShape: "PropertyDefinition"
var PropertyData = Things[IP_AssetThingName].GetPropertyDefinitions({
	category: undefined /* STRING */ ,
	type: undefined /* BASETYPENAME */ ,
	dataShape: undefined /* DATASHAPENAME */
});
// result: INFOTABLE dataShape: ""
var PropertyLiveData = Things[IP_AssetThingName].GetPropertyValuesAsMultiRowTable();


var a = 0;
for (; PropertyData.length > a; a++) {
	var PropertyDataRow = PropertyData.rows[a];
	try {
		// result: INFOTABLE dataShape: "RemotePropertyBinding"
		var BindingData = Things[IP_AssetThingName].GetRemotePropertyBinding({
			propertyName: PropertyDataRow.name /* STRING */
		});
		PropertyDataRow.sourceName = BindingData.sourceName;
		FinalData.AddRow(PropertyDataRow);

	} catch (e) {}

}

var params = {
	columns2: "name,description,baseType,isLogged,isPersistent,isReadOnly,sourceName" /* STRING */ , //
	columns1: "name,quality,time,value" /* STRING */ ,
	joinType: "INNER" /* STRING */ ,
	t1: PropertyLiveData /* INFOTABLE */ ,
	t2: FinalData /* INFOTABLE */ ,
	joinColumns1: "name" /* STRING */ ,
	joinColumns2: "name" /* STRING */
};

// result: INFOTABLE
var JoinData = Resources["InfoTableFunctions"].Intersect(params);
result = JoinData;

Expected Out: 

Arun_C_0-1704465008139.png

Thanks & Regards,

Arun C

Top Tags