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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Multiple Thing Template Sources in One Mashup

ngarner
1-Visitor

Multiple Thing Template Sources in One Mashup

Hello,

I have several models of devices that each have their own unique combination of sensors.  For this example, let's say I have two device models, D1 and D2.

I have two different templates, one for ModelD1 and one for ModelD2.

In a mashup, I would like to be able to be able to display all devices, regardless of type, in a list or grid.  Let's assume grid because I can't figure out how to populate a list for some reason.  When the use selects a device from the grid, I want to move a gauge based on what they selected.

If I had a single template it'd be easy, bind selected row from ModelD->GetImplementingThingsWithData to the gauge and all done.  Since I have two templates things get a bit trickier as I can't bind two data sources to one grid (I think) and I can't bind two different data source return values to one gauge.

I can get the grid to populate with all devices by using a custom shape that I apply to all templates, call it ABCGenericShape.  Then in the mashup I can get data from ABCGenericShape->GetImplementingThingsWithData and change the grid columns to just show the Thing name.  That works fine however based on this model, once the user selects a row, I want to tie a sensor value to the gauge.  The sensor is in a different shape.

It seems the solution here would be to have another data source called something like GetThing that takes a parameter of 'name' and returns the Thing object which I can use to display the value based on model.

So, then what I did was use a tab widget.  I have a tab for D1 Devices and one for D2 Devices.  Each tab has its own grid and I use the ModelD1 Template GetImplementingThingsWithData service to populate the respective table.  This works fine however, I can't have two sources of selected row data going to the same gauge.

What's the best practice to solve this problem?

Thank you for any pointers you can provide,

Nick

P.S. I wish there was an in-depth tutorial/documentation on creating mash-ups.  If there is, please point me that way as I'd love to understand this more fully.

ACCEPTED SOLUTION

Accepted Solutions
ibanham
12-Amethyst
(To:ngarner)

Hi

How you model your Things also has an impact here. If D1 and D2 are both children of a common parent ThingTemplate then using GetImplementingThings for that parent will return all of the D1 and D2 things. Likewise, if D2 was a child of D1, GetImplementingThings for D1 would include all D2 Things as well.

As Pai says you can use a custom service to bring together any combination of Things you desire.

Once you have your list of Things....... In your mashup you can then change the mashup display depending on the ThingTemplate for the selected Thing. You'd need a service that runs on The Selected Rows Changed Event that takes the SelectedRow ThingTemplate as input and returns the appropriate mashup name. You feed that result to a contained mashup widget that is the main part of your mashup. You'll need to use either mashup parameters or the session to pass the name of the selected Thing to the contained mashup so that it can determine which Thing it is displaying data for.

The best in-depth tutorial is either the on-line or classroom training that PTC-U provide. See PTC University - PTC Training - Class Schedule Search

Hope this helps

Regards

Ian

View solution in original post

3 REPLIES 3
PaiChung
22-Sapphire I
(To:ngarner)

These base services like GetImplementingThings with Data really should form the basis of a 'wrapped' service that you use in the Mashup.

So I recommend you create a new Service that retrieves your assets in the way that you need.

With that you can add, grouping, sorting, filtering etc.

ibanham
12-Amethyst
(To:ngarner)

Hi

How you model your Things also has an impact here. If D1 and D2 are both children of a common parent ThingTemplate then using GetImplementingThings for that parent will return all of the D1 and D2 things. Likewise, if D2 was a child of D1, GetImplementingThings for D1 would include all D2 Things as well.

As Pai says you can use a custom service to bring together any combination of Things you desire.

Once you have your list of Things....... In your mashup you can then change the mashup display depending on the ThingTemplate for the selected Thing. You'd need a service that runs on The Selected Rows Changed Event that takes the SelectedRow ThingTemplate as input and returns the appropriate mashup name. You feed that result to a contained mashup widget that is the main part of your mashup. You'll need to use either mashup parameters or the session to pass the name of the selected Thing to the contained mashup so that it can determine which Thing it is displaying data for.

The best in-depth tutorial is either the on-line or classroom training that PTC-U provide. See PTC University - PTC Training - Class Schedule Search

Hope this helps

Regards

Ian

ngarner
1-Visitor
(To:ngarner)

Thank you very much, Pai and Ian.  Good stuff.

Nick

Announcements


Top Tags