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

Connect Things with DataTable

Szymon
5-Regular Member

Connect Things with DataTable

Hi,

I have DataTable containing ID and Name of several different Things. On my Mashup i want to click on Grid row, with specyfic ID and Name and populate TimeSeriesChart with data from Thing.

And also - every Thing will be added by REST Api and there will be 300 of them, so adding it one by one to mashup will not work.

What is propper way to do that?

Please Help.

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaiChung
22-Sapphire I
(To:Szymon)

So you could start with either

GetImplementingThingsWithData that will get you the locations as well that you can then show on a map

Or use GetImplementingThings and use DeriveFields to add the location column - depending on number of properties, this might be more efficient

 

Next based on click, you can do a dynamicThingTemplate querystreamproperty(etc etc) type query to get the value stream entries of the entity clicked.

 

I hope I'm understanding your use case properly.

View solution in original post

5 REPLIES 5
PaiChung
22-Sapphire I
(To:Szymon)

When you say Thing are you referring to actual Thingworx Things?

1. Why store them in a DataTable? Why not use something like GetImplementingThings against a Template?

2. Where is the time series chart data? Usually with the Things in the source, you can use selected row and fire another services to retrieve the time series data to display.

Szymon
5-Regular Member
(To:PaiChung)

Yes, Things as Thingworx Things. More details is needed:

I have 300 Things. Every Thing implements the same template. Every Thing has Location property.

 

I need to show them on map, and be able to click them and show theirs values (including valueStream, wich is needed for TimeSeriesChart).

 

Right now i have created DataTable with Things Location to show markers on map, and service wich adds marker to map, when new Thing is created. But cannot link this to show Values.

Szymon
5-Regular Member
(To:Szymon)

OK,

I Created a TemplateThing with service. Service gets Thing by clicked Name, and fills TemplateThing with values. Although i cannot copy Value Stream with its historical Values. Is Any way to copy all valueStream?

 

Edit: Nah, this doesn't work - i have some services that i fire in mashup, and fireing it on TemplateThing is pointless.

 

Need help. I know that this should be easy - bunch of Things - must show them on map, and after clicking marker - Values are populated in Masup, including TimeSeriesChart. Please Someone Help:)

 

Edit 2:

I have Service like This

 

var things = ThingTemplates["AssetTemplate"].QueryImplementingThings({
maxItems: undefined /* NUMBER */,
nameMask: undefined /* STRING */,
query: undefined /* QUERY */,
tags: undefined
});

var result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({
infoTableName : "InfoTable",
dataShapeName : "AssetThingShape"
});

for(var i=0;(i<1000)&&(i<things.rows.length);i++) {
result.AddRow(things.rows[i]);

}

 

I have correct Infotable count (about 300) but values are empty.

PaiChung
22-Sapphire I
(To:Szymon)

So you could start with either

GetImplementingThingsWithData that will get you the locations as well that you can then show on a map

Or use GetImplementingThings and use DeriveFields to add the location column - depending on number of properties, this might be more efficient

 

Next based on click, you can do a dynamicThingTemplate querystreamproperty(etc etc) type query to get the value stream entries of the entity clicked.

 

I hope I'm understanding your use case properly.

Szymon
5-Regular Member
(To:PaiChung)

I used this bits of information to make some progress. I think it will work. Thanks.

Top Tags