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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Thing shape subscription cannot change property values

HN_AAU
4-Participant

Thing shape subscription cannot change property values

Hi Forum
I have a weird problem in thingworks. I have a thing shape with a data change subscription. The script needs to update a property value and as usual i write "me.<property> = <something>" but for some reason the property does not get updated. If i copy paste the code into a service and execute the service it works just fine. I have a logger message in my script and can see that the subscription is triggered but the data is not updated.

Even more strange, when i make the subscription trigger the service (that i know work) i can see that the service has run, but again no update to the property.... whaaat.... if i then right after trigger the service manually the property updates.

 

I have no clue why this happens. It used to work on 8.4.x since then i have updated to 8.5.0 and now i have this mess. 

 

Hope someone can help me.

1 ACCEPTED SOLUTION

Accepted Solutions
Radu
15-Moonstone
(To:HN_AAU)

Hi,

 

Does the thing that you're testing these properties on implement the thing shape mentioned? Is the subscription enabled? From what you're saying, the code is not the problem, but the subscription. Try inserting a logger message inside the subscription, and see if it appears if you manually change the variable data.

View solution in original post

2 REPLIES 2
Radu
15-Moonstone
(To:HN_AAU)

Hi,

 

Does the thing that you're testing these properties on implement the thing shape mentioned? Is the subscription enabled? From what you're saying, the code is not the problem, but the subscription. Try inserting a logger message inside the subscription, and see if it appears if you manually change the variable data.

HN_AAU
4-Participant
(To:Radu)

Hi

Okay this is strange... it was the simple mistake that the subscription wasn't enabled (they really should be enabled by default) so just enabling it, it all works as it should. Thanks for the help.

 

But one thing i really don't understand is why my logger messages in the subscription still appeared in the script log!? This means that the code is actually still executed while disabled, it just doesn't have any privileges?!

It is even more strange that the logger messages appeared when the code was executed indirectly from a service called by the subscription. This fact makes this kind of stuff near impossible to debug and should really be changed/updated by the developers. spent around 2 hours trying to figure out why the code ran but not doing anything. 

 

Thanks for the help tho. I completely forgot about the enable flag. 

Top Tags