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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Thing template's home mashup - How to load data?

agodbehere
1-Newbie

Thing template's home mashup - How to load data?

I have crated a Thing template (UPerson) that is used to create 5 objects. I've set the home mashup of the template to import the UPerson data dynamically and call getPropertyValues, however the method needs a link to entityName. Where do I get this from? The idea is to be able to open the home mashup of the Things implementing the Thing template and have the same layout, but different data.

1 ACCEPTED SOLUTION

Accepted Solutions

Try this - create a new Mashup and click on the green plus (add entity) on the right, and select your UPerson Template. Now search for the GetImplementingThings service and add that (with Mashup Loaded checked). Now, you can either bind this service to a Grid widget or a List widget based on your preference. If you are using the List widget, remember to choose a value for DisplayField and ValueField to populate the widget, or it would appear blank.

Now click on add entity once again, check dynamic, search for your UPerson Template and add the GetPropertyValues service. Since this is dynamic, it requires an EntityName input. Expand the Selected Rows(s) section on GetImplementingThings and bind the 'name' property to 'EntityName'. Click on 'GetImplementingThings' once again and bind the 'SelectedRowsChanged' event to the 'GetPropertyValues' service. You can now bind 'All Data' of GetPropertyValues to a Grid widget or so.

So when you view your mashup, based on the entity you select on the Grid or the List widget, those properties should change on the 2nd Grid. Does this make sense?

View solution in original post

9 REPLIES 9

Hello,

The entityName is the name of the thing of which you want to get the properties.

This method requires the entityName because you asked it to be dynamic.

I never made a mashup for a ThingTemplate, so I can only give you some clues to Help you:

1. When you create a machup, select thingtemplate. When you click on the mashup (the root of the workspace) you will see "Entity" in the mashup parameters. This is propably where you'll get the name.

2. If it doesn't work, import your ThingTemplate service in the data section but do not choose dynamic

Dragging entity from the workspace hierarchy worked. Thanks!

Update:

It works if I 'edit' the Thing in Composer and click Home Mashup, but it fails to load if I try to load the mashup via a URL (twServer/Thingworx/Things/PER_Tag1). Going to this URL allows me to click on the 'Home Mashup' link, which doesn't work. Is there a way to navigate straight to the home mashup via a URL?

Alex, is there a reason why you are not using a standard Mashup for this task? You could use a service like GetImplementingThings on the Template to get all Things based on that Template, and then dynamically use GetPropertyValues (based on the Thing selected from the previous service).

I was unfamiliar with this approach. Could you elaborate slightly?

As I understand it, I would make a mashup with a list of UPerson Things which I would populate from the GetImplementingThings service. Then based on the selection, I would populate the other controls with the data. Is this correct?

Try this - create a new Mashup and click on the green plus (add entity) on the right, and select your UPerson Template. Now search for the GetImplementingThings service and add that (with Mashup Loaded checked). Now, you can either bind this service to a Grid widget or a List widget based on your preference. If you are using the List widget, remember to choose a value for DisplayField and ValueField to populate the widget, or it would appear blank.

Now click on add entity once again, check dynamic, search for your UPerson Template and add the GetPropertyValues service. Since this is dynamic, it requires an EntityName input. Expand the Selected Rows(s) section on GetImplementingThings and bind the 'name' property to 'EntityName'. Click on 'GetImplementingThings' once again and bind the 'SelectedRowsChanged' event to the 'GetPropertyValues' service. You can now bind 'All Data' of GetPropertyValues to a Grid widget or so.

So when you view your mashup, based on the entity you select on the Grid or the List widget, those properties should change on the 2nd Grid. Does this make sense?

Perfect, thanks! I had already done everything except binding the service.

Glad that worked for you! I'm not sure if you have completed this already, but we do have a ThingWorx tutorial section that goes into detail regarding all functionalities. There are couple exercises in them for you to try out too. Here is the link in case you need it.

yes :

Thingworx/Runtime/index.html#mashup=YourMashupName&Entity=YourEntityName

Top Tags