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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Dynamic_thing_templates services working across

tcoufal
13-Aquamarine

Dynamic_thing_templates services working across

Hi Guys,

could you unriddle me this?

I have a mashup (or a widget) I am using it's parameters to pass on the ThingName(s). In that mashup I am using a DynamicThingTeplate_SomeTemplate services such as getPropertyValues or QueryPropertyValues and I am using results in widgets like Gauges or Charts. EntityName is bound to that Mashup's parameter. I was trying to figure out how to make it work even though if a thingName which I am passing on would not have (based on) the same template. If I choose GenericThing (which is origin of all the things) I cannot bind results to the widgets because the datashape of that result is yet unknown. So I chose one template and tried it anyway, and it worked. Even if I passed on a ThingName based on different template. It also works even if the DataShape is not completely the same - If you have like a Gauge and it is bound to one property named Temperature (for an example) and you pass different Thing which also contains property named Temperature, it will work.

So clearly even though that is Called DynamicThingTemplate_SomeTemplate it is entirely Thing-driven. This is the behavior which I would like to have, but I would like to do it in a way which would be clear and obvious. I cannot based my designs on something which dont fully understand. Maybe its a bug it will be rid off in the future. (exaggerating to make my point).

Could anyone help me to understand underlying processes to replicate this behavior in more controlled manner?


Thanks

10 REPLIES 10

Mashups are not Strong Typed when executed, and that's a good thing. This means, that at least the Thing you are calling has a service with the same name, and with a result with at least match with your bindings it will work.

tcoufal
13-Aquamarine
(To:CarlesColl)

Well it seems like it, but is it by mistake or by design?

I don't know if it's by design, but being Strong Typed would be a big problem to build complex interfaces...

tcoufal
13-Aquamarine
(To:CarlesColl)

You are absolutely right.

I would appreciate more intuitive approach though.

Tomas,

Using this approach is not recommended and may warrant some reconsideration in how your model is structured or how you have defined permissions for Visibility and Run Time.

Do you have a specific use case where you feel that this scenario you've described can really be beneficial even with the model and permissions properly evaluated?

Meghan

tcoufal
13-Aquamarine
(To:mhollenbach)

Meghan,

we I do.

Consider this scenario. I have a base template, things are based on this template, but there is also a specific ThingShape assigned to them which defines their specific properties and services. If I want to display those properties in mashup I have to do it with ThingBased services, If I choose ThingTemplate services (like get implemented thing with data and so on) it wont work because datashape is unknown to MashupBuilder so I can't bind my properties to widgets because they are not present in Result -> All data.

If I choose DynamicThingShapeServices (I cannot use DynamicThingTemplate services for the same reason - datashape unknown) like get property values I can assign my Properties to the widgets. And this will work even if I pass on an Entity (Thing) which uses different DataShape for definition. If there is a Match i show me what I want. This is fine by me, but I would appreciate more elegant and stable solution.


Any Ideas????    

Well it depends on how do you want to show those properties. Some solutions ( using for instance the service: GetPropertyValuesAsMultiRowTable ):

  • *Show properties on a Repeater, then you can show any amount of dynamic properties on the repeater, you don't have to bind each property
  • *Show properties as rows on a Grid

* I use both approaches to dynamically show Properties which come from different ThingTemplates / ThingShapes / Things

Also you can try to use Property Display Widget.

tcoufal
13-Aquamarine
(To:CarlesColl)

Carles,

GetPropertyValuesAsMultiRowTable ):

  • *Show properties on a Repeater, then you can show any amount of dynamic properties on the repeater, you don't have to bind each property

could you elaborate on this a bit?

  • *Show properties as rows on a Grid

With GetPropertyValuesAsMultiRowTable you get an Infotable where Properties are rows, then you can easily put this result on a Grid, and it will be dynamic.

The grid has limitations, as on a given column you can't have different Value Types ( STRING, NUMBER;... ) For this reason it's better to use a Repeater which loads a different submashup for each type of property, here you have an example of our implementation:

Captura de pantalla 2016-07-22 11.20.46.png

tcoufal
13-Aquamarine
(To:CarlesColl)

Thanks Carles,

i will give it a try.

I have tested one Thing's GetPropertyAsMult...... and gives me back nothing... I'll keep working on it..

Announcements


Top Tags