Skip to main content
Jun 21, 2021 11:27 AM UTC
Solved

Convert Valuestream to an Infotable

Hi,

I am currently pushing data up to ThingWorx Composer via an API call which is being stored in a valuestream. Is there any way to convert all this data into an infotable that I can call while writing services? 

Thanks!

abjainAnswer
Jun 21, 2021 1:10 PM UTC

@RS_9963079 : You can use querypropertyhistory service at Thing level which gives you value stream data. If you specifically want to assign it to an infotable property than just assign the result to the property

Ex:

var result = Things["thingname"].QueryPropertyHistory({
oldestFirst: undefined /* BOOLEAN */,
maxItems: undefined /* NUMBER */,
endDate: undefined /* DATETIME */,
query: undefined /* QUERY */,
startDate: undefined /* DATETIME */
});
me.infitc=result;

3 replies

abjainAnswer
Jun 21, 2021 1:10 PM UTC

@RS_9963079 : You can use querypropertyhistory service at Thing level which gives you value stream data. If you specifically want to assign it to an infotable property than just assign the result to the property

Ex:

var result = Things["thingname"].QueryPropertyHistory({
oldestFirst: undefined /* BOOLEAN */,
maxItems: undefined /* NUMBER */,
endDate: undefined /* DATETIME */,
query: undefined /* QUERY */,
startDate: undefined /* DATETIME */
});
me.infitc=result;

Jun 21, 2021 2:43 PM UTC

Thanks so much! Can I ask for an example of an appropriate parameter for "query"? Would it be okay to leave it undefined?

Jun 22, 2021 4:58 AM UTC

@RS_9963079 : Its an optional parameter and need not require to be provided. You can try this service on any thing which has value stream associated and properties 'logged'.