Search code examples
thingworx

Thingworx: Customize `GetImplementingThings` service


I am new to ThingWorx and I want to get some practical flavour of implementing services on this example. I have such data model:

Thing 'Car' has Thing 'Sensor'(Infotable)

I want to have service of CarTemplate that will return all implemented Cars and instead of Sensor's Object it will return Sensor's 'name' property.

What I have now:

"Car1Name" |  SensorObject

What I want:

"Car1Name" | "Accelerator1Name"

Please, help me to make it happens.


Solution

  • There's no kind of "Static" services on ThingTemplates, if you want to recover all Implementing things of a ThingTemplate with properties values you should build a Thing Helper.

    What's a Thing Helper? It's another thing, call it whatever you want, let's say CarHelpers, which has a Service called GetCarsWithSensors, which does a ThingTemplates["ThingTemplateName"].GetImplementingThings(), or a GetImplementingThingsWithData and returns the desired Infotable.