Skip to main content
1-Visitor
October 19, 2017
Solved

QueryImplementingThingsWithData output data shape

  • October 19, 2017
  • 1 reply
  • 2280 views

Hi community,


If I add a template's QueryImplementingThingsWithData service as a data source in a mashup, it returns a list of all the properties defined in that template. All good there.


But: I want to wrap this service call inside a service of my own. Which data shape should I use as the output data shape to get the aforementioned result? Do I always need to create a new data shape of my own?


When creating a new service, under the Entities tab I can find the following code for calling QueryImplementingThingsWithData:

var params = {

     maxItems: undefined /* NUMBER */,

     nameMask: undefined /* STRING */,

     query: undefined /* QUERY */,

     tags: undefined /* TAGS */

};


// result: INFOTABLE dataShape: RootEntityList

var result = ThingTemplates["MyTemplate"].QueryImplementingThingsWithData(params);

Judging by this, the output data shape should be RootEntityList. However, RootEntityList only defines the following properties: avatar, description, homeMashup, isSystemObject, name, tags. Likewise, when I add this custom service as a data source in the mashup builder, these are the only properties that are in the returned data. Thus all other properties defined in the template are unbindable in mashup builder. What gives?

Best answer by CarlesColl

You are right on the second paragraph, you need to create a custom DataShape.

1 reply

1-Visitor
October 19, 2017

You are right on the second paragraph, you need to create a custom DataShape.

mlähde1-VisitorAuthor
1-Visitor
October 20, 2017

Ok, thank you.

I guess then my question would be, why does the QueryImplementingThingsWithData service (or any other similar service) work without declaring a data shape when called directly from a mashup? Is there some underlying logic that does it dynamically?

1-Visitor
October 20, 2017

We don't have that option, this is only done by built-in services.

You can have kind of dynamic service result binding using Grid Widget ( with Show All Columns to true ) also TimeSeries Graphs can handle it.