Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
I have set up an event which changes the number value of a property of one of my things. I have set a button to trigger this event when clicked in thingworx studio. This works perfectly the first time I click it, but if I am in the same preview or instance on view then if I try to trigger it again then nothing happens. I need to refresh in order to trigger the event again. I'm not sure what is going on here and what I need to do to fix this problem.
Any help would be much appreciated.
Thanks,
Adam
Solved! Go to Solution.
I have been told that it is a bug and there is a work around. I am assuming that your service increment has output set to "nothing"? If this is the case then the workaround is setting an output (it doesn't matter what it is) arbitrarily let the name be "result". Then add a line of code at the end of the javascript within your service as: var result=0; (the 0 is arbitrary and doesn't have any effect on anything)
This allows events to trigger multiple times, but as I say it's a work around and the services should work with the output as nothing.
To clarify: your button is triggering a service in ThingWorx that modifies the value of a property on that Thing. The property value is displayed in your experience. See picture below.
I reproduced the case and for me it works exactly as you described: The value is incremented the first time the button is hit but on subsequent hits nothing happens. To me this seems to be a bug . But maybe there is a workaround with some 'dirty' or 'event reset' flagging via javascript?!?
I have been told that it is a bug and there is a work around. I am assuming that your service increment has output set to "nothing"? If this is the case then the workaround is setting an output (it doesn't matter what it is) arbitrarily let the name be "result". Then add a line of code at the end of the javascript within your service as: var result=0; (the 0 is arbitrary and doesn't have any effect on anything)
This allows events to trigger multiple times, but as I say it's a work around and the services should work with the output as nothing.
little typo, it just be:
var result = 0;
Thanks, corrected now