Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
In a Thingworx service, we are setting a property value inside a script. The property is a remotely bound tag to Kepware. In the next line, we are trying to read the value but instead of getting the recently set value we get the old value.
logger.debug(me.value); // Value is 0 initially
me.value = 1;
logger.debug(me.value); // Still returns 0
Is this the expected behavior? We have tried both "read from cache" and "fetch from remote" settings on the parameter.
If we add a pause to the code we need about 200 ms to get the new value.
Many thanks!
Erik
Solved! Go to Solution.
So you have a read/write tag that you set and then read?
What happens is, you set the tag, it goes to Kepware, on the next cycle Kepware sends that value back to Thingworx.
So the roundtrip probably is inducing that delay because if you run the set and get right after eachother it will be finished in a milisecond or less.
is it important for one reason or another that you read the value right away after setting it?
I think if you do this from a mashup - Set - ServiceInvoke Completed - Get you probably won't run into this behavior.
So you have a read/write tag that you set and then read?
What happens is, you set the tag, it goes to Kepware, on the next cycle Kepware sends that value back to Thingworx.
So the roundtrip probably is inducing that delay because if you run the set and get right after eachother it will be finished in a milisecond or less.
is it important for one reason or another that you read the value right away after setting it?
I think if you do this from a mashup - Set - ServiceInvoke Completed - Get you probably won't run into this behavior.
Thank you - now we understand how the system works so we can find a solution.
Best regards
Erik