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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

How to use QueryImplementingThingsWithNamedData?

AndreaSteyn
12-Amethyst

How to use QueryImplementingThingsWithNamedData?

I am trying to use the new QueryImplementingThingsWithNamedData service in Thingworx.

 

According to the help file I need to have the basicPropertyNames as a InfoTable. How does this info table look or where do I get this infotable?

 

This is how my query looks currently:
var result = ThingTemplates["GGC.RC.TT"].QueryImplementingThingsWithNamedData({
maxItems: undefined /* NUMBER */,
basicPropertyNames: "SampleCode" /* INFOTABLE */,
nameMask: undefined /* STRING */,
propertyNames: undefined/* INFOTABLE */,
query: undefined /* QUERY */,
tags: undefined /* TAGS */
});

 

Thanks

ACCEPTED SOLUTION

Accepted Solutions
cmorfin
19-Tanzanite
(To:AndreaSteyn)

Hi @AndreaSteyn 

 

Apologies for the delay in answering.

The propertyNames and basicPropertyNames are infoTable using the EntityList system dataShape.

 

For example

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

// CreateInfoTableFromDataShape
var propInfoTable = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);

// EntityList entry object
var newEntry = new Object();
newEntry.name = "prop1"; // STRING [Primary Key]
newEntry.description = undefined; // STRING

propInfoTable.AddRow(newEntry);


// CreateInfoTableFromDataShape
var basicpropInfoTable = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);

// EntityList entry object
var newEntry = new Object();
newEntry.name = "name"; // STRING [Primary Key]
newEntry.description = undefined; // STRING

basicpropInfoTable.AddRow(newEntry);



var result =  ThingTemplates["CMOTemplate"].QueryImplementingThingsWithNamedData({
maxItems: undefined /* NUMBER */,
nameMask: undefined /* STRING */,
propertyNames: propInfoTable,
basicPropertyNames: basicpropInfoTable,
query: undefined /* QUERY */,
tags: undefined /* TAGS */
});

 

Hope this helps

Christophe

 

View solution in original post

2 REPLIES 2
cmorfin
19-Tanzanite
(To:AndreaSteyn)

Hi @AndreaSteyn 

 

Apologies for the delay in answering.

The propertyNames and basicPropertyNames are infoTable using the EntityList system dataShape.

 

For example

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

// CreateInfoTableFromDataShape
var propInfoTable = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);

// EntityList entry object
var newEntry = new Object();
newEntry.name = "prop1"; // STRING [Primary Key]
newEntry.description = undefined; // STRING

propInfoTable.AddRow(newEntry);


// CreateInfoTableFromDataShape
var basicpropInfoTable = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);

// EntityList entry object
var newEntry = new Object();
newEntry.name = "name"; // STRING [Primary Key]
newEntry.description = undefined; // STRING

basicpropInfoTable.AddRow(newEntry);



var result =  ThingTemplates["CMOTemplate"].QueryImplementingThingsWithNamedData({
maxItems: undefined /* NUMBER */,
nameMask: undefined /* STRING */,
propertyNames: propInfoTable,
basicPropertyNames: basicpropInfoTable,
query: undefined /* QUERY */,
tags: undefined /* TAGS */
});

 

Hope this helps

Christophe

 

Thank you that was very helpful.

Announcements


Top Tags