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

How to use QueryImplementingThingsWithNamedData?

SOLVED
Participant

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

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: How to use QueryImplementingThingsWithNamedData?

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
Highlighted

Re: How to use QueryImplementingThingsWithNamedData?

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

Re: How to use QueryImplementingThingsWithNamedData?

Thank you that was very helpful.