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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Creating and Setting ValueStream programatically to a thing

amittal-3
14-Alexandrite

Creating and Setting ValueStream programatically to a thing

Hello,

I am creating a ValueStream programatically in a service using createThing function and assigning the same to a thing using setValueStream() function.

[Reference: https://community.ptc.com/t5/ThingWorx-Developers/How-to-create-Valuestream-with-script/td-p/515958]

I have taken the necessary precautions while assigning the value stream, such as verify that the thing is created and then performing enable and restart thing

[Reference: https://community.ptc.com/t5/ThingWorx-Developers/JavaScript-CreateThing-Thing-is-not-running/td-p/508232]

But some how when I see that thing in composer, I do not see the value stream attached to it, how ever when I call 'getValueStream' for that thing it returns me the valid value stream. I can see this on "Entity Depends on" for the thing to which value stream is assigned and also on "Uses this Entity" for the created value stream.

So I assume that value stream is successfully assigned, but I cannot see it when I view that thing in Composer as shown in attached image [IMAGE1] with red selection.

Is this expected behaviour?

Thanks in Advance

Aditya Mittal

3 REPLIES 3

Shouldn't be the correct behaviour, if you restart Tomcat the ValueStream is still there?

amittal-3
14-Alexandrite
(To:CarlesColl)

Hello Carles,

Yes you caught at the right place. I am using the Thingworx trial edition (docker version), so I restarted my docker (which implicitly means that Tomcat is restarted). After this Value stream and things that I created exists but, now those valuestreams are no longer assigned to corresponding things.

So how can we sort this problem? Any suggestions?

I can although add checks in my things at thingstart subscription to assign them value streams if they are not assigned, but I would still like to know what could have caused this issue?

Because previously not only value streams were assigned but they were functioning also as expected.

I verified this behaviour by using QueryPropertyHistory service, which fetches logged data from value stream

Please let me know your opinion about this.

Thanks and Regards

Aditya Mittal

Can you share the code please.

Announcements


Top Tags