I am using ThingWorx 8.5.3-b123 and I am trying to use an expression to get the user's local timezone offset from UTC. I created an expression with no parameters and have it evaluate the following for testing:
Output = 4;
The output is bound to a parameter of a thing service and the "Changed" property of the expression is bound to evaluate the service. I then bound the mashup "Loaded" to evaluate the expression. I left auto evaluate and fire on first value unchecked, and I set data change type to always. For some reason, I still never get a value in the parameter of my service! I get errors saying JSON does not allow non-finite numbers. If I set a default value to this parameter of my service, all works well but it's obviously not a solution. Anybody have any ideas? Thanks
@JJ_9237608 : Have you tried binding the output to a value display widget and checked its value? Would be great if you can provide entities for replicating your issue.
I bound it to a label widget and it showed 4, as appropriate. I discovered that the mashup preview button is actually functioning perfectly whereas the live mashup is not. I am sure that I'm saving properly, so I really can't figure why it isn't publishing my changes on this mashup. When I make other changes like datasets or services, it shows up just fine. Attached below are some screenshots of the preview and real mashup.
Expression sometimes behave differently. I am doing same what you have explained.
On mashup load calling expression, on change of expression I am calling a status message and output of expression is going in to status message. It is behaving ok.
I believe you need to change the body of expression to output=4 instead of Output=4.
It seems that the expression is working now, but as I wrote above to the other commenter, it seems like the mashup isn't updating now. Any ideas?
I can see the correctly working mashup in the preview, but despite clicking save and the changes being there after a refresh, the real production page doesn't show the changes, and I can see errors in my script log indicating that there is no value being passed into the service.
Have you tried different browsers to see if you get the same results? If so, can you provide your mashup so we can test it here?
Hi @JJ_9237608 ,
Expression does not need "output". If you want your expression to output the number 4, the only thing you need in the code is "4" without the quotes, obviously. That's why the "non-finite numbers" error.